mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: added limits to /today
This commit is contained in:
1 parent
438feefa83
commit
297f2f6580
3 files changed
+46
-33
No files matched your search
+12
-2
@@ -21,10 +21,20 @@ export const todayCommand: CommandRegistry = {
|
||||
command: new SlashCommandBuilder()
|
||||
.setName('today')
|
||||
.setDescription('A general daily breakdown of your performance')
|
||||
.addStringOption(addUsernameChoices),
|
||||
.addStringOption(addUsernameChoices)
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName('limit')
|
||||
.setDescription(
|
||||
'The maximum number of tanks to display (default: Infinity)',
|
||||
)
|
||||
.setRequired(false)
|
||||
.setMinValue(1),
|
||||
),
|
||||
|
||||
async handler(interaction) {
|
||||
const player = await resolvePlayerFromCommand(interaction);
|
||||
const limit = interaction.options.getInteger('limit') ?? Infinity;
|
||||
const { nickname } = (
|
||||
await getWargamingResponse<AccountInfo>(
|
||||
`https://api.wotblitz.${player.server}/wotb/account/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${player.id}`,
|
||||
@@ -33,7 +43,7 @@ export const todayCommand: CommandRegistry = {
|
||||
const path = interactionToURL(interaction, player);
|
||||
|
||||
return [
|
||||
await today(player),
|
||||
await today(player, limit, false),
|
||||
primaryButton(path, 'Refresh'),
|
||||
linkButton(`${CYCLIC_API}/${path}`, 'Embed'),
|
||||
linkButton(
|
||||
|
||||
Reference in new issue
Block a user