feat: added basic infrastructure for ratings command

This commit is contained in:
TresAbhi committed 2023-07-15 18:44:20 +00:00
1 parent 9419aec116
commit aa6011b18d
40 files changed
+227 -96

No files matched your search

+4 -4
View File
@@ -26,7 +26,7 @@ export const statsCommand: CommandRegistry = {
command: addStatTypeSubCommandGroups(
new SlashCommandBuilder()
.setName('stats')
.setDescription('In-game statistics'),
.setDescription('Regular battles statistics'),
),
async handler(interaction) {
@@ -34,7 +34,7 @@ export const statsCommand: CommandRegistry = {
true,
) as StatType;
const player = await resolvePlayerFromCommand(interaction);
const period = resolvePeriodFromCommand(player.server, interaction);
const period = resolvePeriodFromCommand(player.region, interaction);
const tankIdRaw = interaction.options.getString('tank')!;
const tankId =
commandGroup === 'tank' ? await resolveTankId(tankIdRaw) : null;
@@ -48,7 +48,7 @@ export const statsCommand: CommandRegistry = {
});
const { nickname } = (
await getWargamingResponse<AccountInfo>(
`https://api.wotblitz.${player.server}/wotb/account/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${player.id}`,
`https://api.wotblitz.${player.region}/wotb/account/info/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${player.id}`,
)
)[player.id];
@@ -57,7 +57,7 @@ export const statsCommand: CommandRegistry = {
primaryButton(path, 'Refresh'),
linkButton(`${CYCLIC_API}/${path}`, 'Embed'),
linkButton(
`https://www.blitzstars.com/player/${player.server}/${nickname}`,
`https://www.blitzstars.com/player/${player.region}/${nickname}`,
'BlitzStars',
),
];