diff --git a/bun.lockb b/bun.lockb index 388393570..400436ef2 100644 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/bot/package.json b/packages/bot/package.json index f66ab8fd3..6e5c7e2fe 100644 --- a/packages/bot/package.json +++ b/packages/bot/package.json @@ -7,7 +7,7 @@ "@blitzkit/core": "workspace:*", "satori": "^0.10.14", "@resvg/resvg-js": "^2.6.2", - "discord.js": "^14.15.3", + "discord.js": "^14.16.3", "react": "^18.3.1", "@radix-ui/colors": "^3.0.0", "fuzzysort": "^2.0.4", diff --git a/packages/bot/src/commands/auction.ts b/packages/bot/src/commands/auction.ts index eac778a38..fa886a125 100644 --- a/packages/bot/src/commands/auction.ts +++ b/packages/bot/src/commands/auction.ts @@ -29,8 +29,8 @@ type Result = next_price?: Price | null; available: true; display?: boolean; - next_price_datetime?: Date | null; - next_price_timestamp?: number | null; + next_price_datetime: Date; + next_price_timestamp: number; } | { available: false; @@ -69,12 +69,10 @@ interface Currency { export const auctionCommand = new Promise((resolve) => { resolve({ - command: createLocalizedCommand('auction', [ - { subcommand: 'available' }, - { subcommand: 'setup' }, - ]), + command: createLocalizedCommand('auction'), async handler(interaction) { + const { t, translate } = translator(interaction.locale); const awaitedTankDefinitions = await tankDefinitions; const region: Region = 'com'; const pageSize = 80; @@ -86,15 +84,21 @@ export const auctionCommand = new Promise((resolve) => { pageSize }&type[]=vehicle&saleable=${saleable}`, ).then((response) => response.json() as Promise); - const seeableTanks = data.results.filter((result) => result.available); - const { t, translate } = translator(interaction.locale); + const saleableTanks = data.results.filter((result) => result.available); - const title = `# ${t`bot.commands.auction.subcommands.available.body.title`}`; - const subtitle = `-# ${translate( - 'bot.commands.auction.subcommands.available.body.available', - [`${seeableTanks.length} / ${data.results.length}`], - )}`; - const body = seeableTanks + if (saleableTanks.length === 0) { + return t`bot.commands.auction.errors.no_auction`; + } + + const nextPricesTimestamp = saleableTanks[0].next_price_timestamp; + + const title = `# ${t`bot.commands.auction.body.title`}`; + const subtitle = `${translate('bot.commands.auction.body.subtitle', [ + `${saleableTanks.length} / ${data.results.length}`, + ``, + '', + ])}`; + const body = saleableTanks .map((data, index) => { const tank = awaitedTankDefinitions.tanks[data.entity!.id]; @@ -103,14 +107,11 @@ export const auctionCommand = new Promise((resolve) => { const name = `[${tank.name}]()`; - const next = translate( - 'bot.commands.auction.subcommands.available.body.next', - [ - `<:gold:1317173197082333244> ${data.next_price!.value.toLocaleString( - interaction.locale, - )}`, - ], - ); + const next = translate('bot.commands.auction.body.next', [ + `<:gold:1317173197082333244> ${data.next_price!.value.toLocaleString( + interaction.locale, + )}`, + ]); return `${ index + 1 @@ -119,8 +120,9 @@ export const auctionCommand = new Promise((resolve) => { )}\n-# ${next}`; }) .join('\n\n'); + const content = `${title}\n${subtitle}\n\n${body}`; - return `${title}\n${subtitle}\n\n${body}`; + return content; }, }); }); diff --git a/packages/core/lang/en-US.json b/packages/core/lang/en-US.json index d23c62126..3ebb10239 100644 --- a/packages/core/lang/en-US.json +++ b/packages/core/lang/en-US.json @@ -293,22 +293,18 @@ "commands": { "auction": { "$": "auction", - "description": "Tanks available in the auction", + "description": "Tanks available right now in the auction", - "subcommands": { - "available": { - "$": "available", - "description": "Tanks available right now in the auction", - "body": { - "title": "Blitz Auction", - "available": "%s available", - "next": "Next price: %s" - } - }, - "setup": { - "$": "setup", - "description": "Set up a channel to receive auction updates" - } + "body": { + "title": "Blitz Auction", + "subtitle": "%s available • next prices %s\nBid now: %s", + "next": "Next price: %s" + }, + "errors": { + "no_auction": "# No ongoing auction\n\nCurrently, there are no tanks available for purchase in the auction. If you think this is an error, please report this discrepancy in [the official Discord Server](https://discord.gg/nDt7AjGJQH)." + }, + "actions": { + "bid": "Bid now" } },