feat: /auction strikethrough and warning

This commit is contained in:
tresabhi committed 2024-12-15 19:06:05 -06:00
1 parent 4f6b41e264
commit bb99220497
1 file changed
+10 -4
+10 -4
View File
@@ -68,6 +68,8 @@ interface Currency {
type: 'currency'; type: 'currency';
} }
const WARNING_COUNT = 500;
export const auctionCommand = new Promise<CommandRegistry>((resolve) => { export const auctionCommand = new Promise<CommandRegistry>((resolve) => {
resolve({ resolve({
command: createLocalizedCommand('auction'), command: createLocalizedCommand('auction'),
@@ -116,12 +118,16 @@ export const auctionCommand = new Promise<CommandRegistry>((resolve) => {
data.current_count.toLocaleString(interaction.locale), data.current_count.toLocaleString(interaction.locale),
data.initial_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 `${ return `${index + 1}. ${
index + 1 outString
}. ${name} <:gold:1317173197082333244> ${data.price!.value.toLocaleString( }${name} <:gold:1317173197082333244> ${data.price!.value.toLocaleString(
interaction.locale, interaction.locale,
)}\n-# ${available}\n-# ${next}`; )}${outString}\n-# ${available}${isLow ? ' ⚠️' : ''}${isOut ? '' : nextLine}`;
}); });
const header = `${title}\n${subtitle}`; const header = `${title}\n${subtitle}`;
const lines = [header, ...body]; const lines = [header, ...body];