mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: chunk lines for /auction
This commit is contained in:
1 parent
d9f6acea2d
commit
03ec44c765
1 file changed
+25
-25
@@ -4,6 +4,7 @@ import {
|
|||||||
regionToRegionSubdomain,
|
regionToRegionSubdomain,
|
||||||
} from '@blitzkit/core';
|
} from '@blitzkit/core';
|
||||||
import { tankDefinitions } from '../core/blitzkit/nonBlockingPromises';
|
import { tankDefinitions } from '../core/blitzkit/nonBlockingPromises';
|
||||||
|
import { chunkLines } from '../core/discord/chunkLines';
|
||||||
import { createLocalizedCommand } from '../core/discord/createLocalizedCommand';
|
import { createLocalizedCommand } from '../core/discord/createLocalizedCommand';
|
||||||
import { translator } from '../core/localization/translator';
|
import { translator } from '../core/localization/translator';
|
||||||
import { CommandRegistry } from '../events/interactionCreate';
|
import { CommandRegistry } from '../events/interactionCreate';
|
||||||
@@ -98,35 +99,34 @@ export const auctionCommand = new Promise<CommandRegistry>((resolve) => {
|
|||||||
`<t:${nextPricesTimestamp}:R>`,
|
`<t:${nextPricesTimestamp}:R>`,
|
||||||
'<https://wotblitz.com/auction/>',
|
'<https://wotblitz.com/auction/>',
|
||||||
])}`;
|
])}`;
|
||||||
const body = saleableTanks
|
const body = saleableTanks.map((data, index) => {
|
||||||
.map((data, index) => {
|
const tank = awaitedTankDefinitions.tanks[data.entity!.id];
|
||||||
const tank = awaitedTankDefinitions.tanks[data.entity!.id];
|
|
||||||
|
|
||||||
if (!tank) return '';
|
if (!tank) return '';
|
||||||
|
|
||||||
const name = `[${tank.name}](<https://blitzkit.app/tools/tankopedia/${
|
const name = `[${tank.name}](<https://blitzkit.app/tools/tankopedia/${
|
||||||
tank.id
|
tank.id
|
||||||
}>)`;
|
}>)`;
|
||||||
const next = translate('bot.commands.auction.body.next', [
|
const next = translate('bot.commands.auction.body.next', [
|
||||||
`<:gold:1317173197082333244> ${data.next_price!.value.toLocaleString(
|
`<: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),
|
|
||||||
]);
|
|
||||||
|
|
||||||
return `${
|
|
||||||
index + 1
|
|
||||||
}. ${name} <:gold:1317173197082333244> ${data.price!.value.toLocaleString(
|
|
||||||
interaction.locale,
|
interaction.locale,
|
||||||
)}\n-# ${available}\n-# ${next}`;
|
)}`,
|
||||||
})
|
]);
|
||||||
.join('\n\n');
|
const available = translate('bot.commands.auction.body.available', [
|
||||||
const content = `${title}\n${subtitle}\n\n${body}`;
|
data.current_count.toLocaleString(interaction.locale),
|
||||||
|
data.initial_count.toLocaleString(interaction.locale),
|
||||||
|
]);
|
||||||
|
|
||||||
return content;
|
return `${
|
||||||
|
index + 1
|
||||||
|
}. ${name} <:gold:1317173197082333244> ${data.price!.value.toLocaleString(
|
||||||
|
interaction.locale,
|
||||||
|
)}\n-# ${available}\n-# ${next}`;
|
||||||
|
});
|
||||||
|
const header = `${title}\n${subtitle}`;
|
||||||
|
const lines = [header, ...body];
|
||||||
|
|
||||||
|
return chunkLines(lines, '\n\n');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user