From bb99220497e6e04f3fc3616cb3c3c60930b3d2bf Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Sun, 15 Dec 2024 19:06:05 -0600 Subject: [PATCH] feat: /auction strikethrough and warning --- packages/bot/src/commands/auction.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/bot/src/commands/auction.ts b/packages/bot/src/commands/auction.ts index d9c97a330..ed5a85285 100644 --- a/packages/bot/src/commands/auction.ts +++ b/packages/bot/src/commands/auction.ts @@ -68,6 +68,8 @@ interface Currency { type: 'currency'; } +const WARNING_COUNT = 500; + export const auctionCommand = new Promise((resolve) => { resolve({ command: createLocalizedCommand('auction'), @@ -116,12 +118,16 @@ export const auctionCommand = new Promise((resolve) => { 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; - return `${ - index + 1 - }. ${name} <:gold:1317173197082333244> ${data.price!.value.toLocaleString( + return `${index + 1}. ${ + outString + }${name} <:gold:1317173197082333244> ${data.price!.value.toLocaleString( interaction.locale, - )}\n-# ${available}\n-# ${next}`; + )}${outString}\n-# ${available}${isLow ? ' ⚠️' : ''}${isOut ? '' : nextLine}`; }); const header = `${title}\n${subtitle}`; const lines = [header, ...body];