mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: handle no next price
This commit is contained in:
1 parent
50a3d1e922
commit
e7f47fd2fd
1 file changed
+10
-8
@@ -27,7 +27,7 @@ type Result =
|
||||
available_from?: Date;
|
||||
available_before?: Date;
|
||||
price?: Price;
|
||||
next_price?: Price | null;
|
||||
next_price: Price | null;
|
||||
available: true;
|
||||
display?: boolean;
|
||||
next_price_datetime: Date;
|
||||
@@ -109,16 +109,18 @@ export const auctionCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
const name = `[${tank.name}](<https://blitzkit.app/tools/tankopedia/${
|
||||
tank.id
|
||||
}>)`;
|
||||
const next = translate('bot.commands.auction.body.next', [
|
||||
`<:gold:1317173197082333244> ${data.next_price!.value.toLocaleString(
|
||||
interaction.locale,
|
||||
)}`,
|
||||
]);
|
||||
const next =
|
||||
data.next_price === null
|
||||
? ''
|
||||
: `\n-# ${translate('bot.commands.auction.body.next', [
|
||||
`<:gold:1317173197082333244> ${data.next_price.value.toLocaleString(
|
||||
interaction.locale,
|
||||
)}`,
|
||||
])}`;
|
||||
const available = translate('bot.commands.auction.body.available', [
|
||||
data.current_count.toLocaleString(interaction.locale),
|
||||
data.initial_count.toLocaleString(interaction.locale),
|
||||
]);
|
||||
const nextLine = `\n-# ${next}`;
|
||||
const isOut = data.current_count === 0;
|
||||
const outString = isOut ? '~~' : '';
|
||||
const isLow = data.current_count <= WARNING_COUNT;
|
||||
@@ -127,7 +129,7 @@ export const auctionCommand = new Promise<CommandRegistry>((resolve) => {
|
||||
outString
|
||||
}${name} <:gold:1317173197082333244> ${data.price!.value.toLocaleString(
|
||||
interaction.locale,
|
||||
)}${outString}\n-#${isLow ? ' ‼️ ' : ' '}${available}${isOut ? '' : nextLine}`;
|
||||
)}${outString}\n-#${isLow ? ' ‼️ ' : ' '}${available}${isOut ? '' : next}`;
|
||||
});
|
||||
const header = `${title}\n${subtitle}`;
|
||||
const lines = [header, ...body];
|
||||
|
||||
Reference in new issue
Block a user