feat: updated /evolution

This commit is contained in:
TrèsAbhi committed 2023-10-12 11:56:11 -05:00
1 parent 8c3675546f
commit bcd3a00f91
6 files changed
+107 -99

No files matched your search

@@ -3,7 +3,7 @@ import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID
import { PlayerClanInfo } from '../../types/playerClanData';
import getWargamingResponse from './getWargamingResponse';
export function playerClanInfo(region: Region, id: number) {
export function getPlayerClanInfo(region: Region, id: number) {
return getWargamingResponse<PlayerClanInfo>(
`https://api.wotblitz.${region}/wotb/clans/accountinfo/?application_id=${WARGAMING_APPLICATION_ID}&account_id=${id}&extra=clan`,
);
+10 -3
View File
@@ -1,10 +1,14 @@
import { SlashCommandBuilder, SlashCommandSubcommandBuilder } from 'discord.js';
import {
SlashCommandBuilder,
SlashCommandSubcommandBuilder,
SlashCommandSubcommandGroupBuilder,
} from 'discord.js';
export type PeriodType = 'today' | '30' | '60' | '90' | 'custom';
export type PeriodType = 'today' | '30' | '60' | '90' | 'career' | 'custom';
export type PeriodSize = 'today' | `${number}` | 'career';
export default function addPeriodSubCommands(
option: SlashCommandBuilder,
option: SlashCommandBuilder | SlashCommandSubcommandGroupBuilder,
extra: (
option: SlashCommandSubcommandBuilder,
) => SlashCommandSubcommandBuilder = (option) => option,
@@ -22,6 +26,9 @@ export default function addPeriodSubCommands(
.addSubcommand((option) =>
extra(option.setName('90').setDescription('90 days')),
)
.addSubcommand((option) =>
extra(option.setName('career').setDescription('Career')),
)
.addSubcommand((option) =>
extra(
option
@@ -1,16 +1,22 @@
import { SlashCommandBuilder, SlashCommandSubcommandBuilder } from 'discord.js';
import {
SlashCommandBuilder,
SlashCommandSubcommandBuilder,
SlashCommandSubcommandGroupBuilder,
} from 'discord.js';
import { TREE_TYPE_NAMES, TreeTypeString } from '../../components/Tanks';
import { tankopediaInfo } from '../blitz/tankopedia';
import addPeriodSubCommands from './addPeriodSubCommands';
import addTankChoices from './addTankChoices';
import addTierChoices from './addTierChoices';
export default async function addStatTypeSubCommandGroups(
option: SlashCommandBuilder,
export default async function addStatTypeSubCommands<
OptionType extends SlashCommandBuilder | SlashCommandSubcommandGroupBuilder,
>(
option: OptionType,
extra: (
option: SlashCommandSubcommandBuilder,
) => SlashCommandSubcommandBuilder = (option) => option,
) {
): Promise<OptionType> {
const awaitedTankopediaInfo = await tankopediaInfo;
addPeriodSubCommands(option, (option) => {