2023-06-23 01:45:44 +00:00
|
|
|
import { SlashCommandBuilder } from 'discord.js';
|
2023-06-21 01:52:26 +00:00
|
|
|
import tanksAutocomplete from '../core/autocomplete/tanks.js';
|
|
|
|
|
import usernameAutocomplete from '../core/autocomplete/username.js';
|
|
|
|
|
import resolveTankId from '../core/blitz/resolveTankId.js';
|
2023-06-21 01:57:27 +00:00
|
|
|
import addStatsSubCommandGroups from '../core/options/addStatsSubCommandGroups.js';
|
2023-06-23 01:35:15 +00:00
|
|
|
import resolvePeriod from '../core/options/resolvePeriod.js';
|
|
|
|
|
import resolvePlayer from '../core/options/resolvePlayer.js';
|
2023-06-21 01:52:26 +00:00
|
|
|
import { CommandRegistry } from '../events/interactionCreate.js';
|
2023-06-23 01:45:44 +00:00
|
|
|
import evolution from '../renderers/evolution.js';
|
|
|
|
|
import { StatType } from '../renderers/stats.js';
|
2023-06-21 01:52:26 +00:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
inProduction: true,
|
2023-06-23 01:45:44 +00:00
|
|
|
inDevelopment: true,
|
2023-06-21 01:52:26 +00:00
|
|
|
inPublic: true,
|
|
|
|
|
|
2023-06-21 01:57:27 +00:00
|
|
|
command: addStatsSubCommandGroups(
|
|
|
|
|
new SlashCommandBuilder()
|
2023-06-21 02:01:12 +00:00
|
|
|
.setName('evolution')
|
2023-06-21 01:57:27 +00:00
|
|
|
.setDescription('Evolution of statistics'),
|
|
|
|
|
),
|
2023-06-21 01:52:26 +00:00
|
|
|
|
|
|
|
|
async execute(interaction) {
|
2023-06-23 01:45:44 +00:00
|
|
|
const commandGroup = interaction.options.getSubcommandGroup(
|
|
|
|
|
true,
|
|
|
|
|
) as StatType;
|
|
|
|
|
const player = await resolvePlayer(interaction);
|
|
|
|
|
const period = resolvePeriod(interaction);
|
2023-06-21 01:52:26 +00:00
|
|
|
const tankIdRaw = interaction.options.getString('tank')!;
|
2023-06-23 01:45:44 +00:00
|
|
|
const tankId = commandGroup === 'tank' ? resolveTankId(tankIdRaw) : 0;
|
2023-06-21 01:52:26 +00:00
|
|
|
|
2023-06-23 01:45:44 +00:00
|
|
|
return await evolution(commandGroup, period, player, tankId);
|
2023-06-21 01:52:26 +00:00
|
|
|
|
2023-06-23 01:45:44 +00:00
|
|
|
// new ButtonBuilder()
|
|
|
|
|
// .setStyle(ButtonStyle.Link)
|
|
|
|
|
// .setLabel('View on BlitzStars')
|
|
|
|
|
// .setURL(
|
|
|
|
|
// commandGroup === 'tank'
|
|
|
|
|
// ? `https://www.blitzstars.com/player/com/${
|
|
|
|
|
// accountInfo[id].nickname
|
|
|
|
|
// }/tank/${tankId!}`
|
|
|
|
|
// : `https://www.blitzstars.com/player/com/${accountInfo[id].nickname}`,
|
|
|
|
|
// );
|
2023-06-21 01:52:26 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
|
|
autocomplete: (interaction) => {
|
|
|
|
|
usernameAutocomplete(interaction);
|
|
|
|
|
tanksAutocomplete(interaction);
|
|
|
|
|
},
|
|
|
|
|
} satisfies CommandRegistry;
|