feat: no flags

This commit is contained in:
TrèsAbhi committed 2024-01-27 17:36:29 -06:00
1 parent 0250546ab5
commit e835498e59
13 files changed
+72 -61

No files matched your search

+4 -4
View File
@@ -3,7 +3,7 @@ import {
SlashCommandSubcommandBuilder,
SlashCommandSubcommandGroupBuilder,
} from 'discord.js';
import { TREE_TYPE_NAMES, TreeTypeString } from '../../components/Tanks';
import { TREE_TYPE_NAMES, TreeType } from '../../components/Tanks';
import { encyclopediaInfo } from '../blitz/encyclopediaInfo';
import addPeriodSubCommands from './addPeriodSubCommands';
import addTankChoices from './addTankChoices';
@@ -56,15 +56,15 @@ export default async function addFilterOptions<
.addChoices(
{
name: TREE_TYPE_NAMES['researchable'],
value: 'researchable' satisfies TreeTypeString,
value: 'researchable' satisfies TreeType,
},
{
name: TREE_TYPE_NAMES.premium,
value: 'premium' satisfies TreeTypeString,
value: 'premium' satisfies TreeType,
},
{
name: TREE_TYPE_NAMES.collector,
value: 'collector' satisfies TreeTypeString,
value: 'collector' satisfies TreeType,
},
)
.setRequired(false),
+2 -3
View File
@@ -1,5 +1,5 @@
import { ButtonInteraction } from 'discord.js';
import { TreeTypeString } from '../../components/Tanks';
import { TreeType } from '../../components/Tanks';
import { StatFilters } from '../statistics/filterStats';
export function getFiltersFromButton(interaction: ButtonInteraction) {
@@ -10,8 +10,7 @@ export function getFiltersFromButton(interaction: ButtonInteraction) {
tank: parseInt(url.searchParams.get('tank') ?? '0') || undefined,
tankType: url.searchParams.get('tank-type') ?? undefined,
treeType:
(url.searchParams.get('tree-type') as TreeTypeString | undefined) ??
undefined,
(url.searchParams.get('tree-type') as TreeType | undefined) ?? undefined,
tier: parseInt(url.searchParams.get('tier') ?? '0') || undefined,
} satisfies StatFilters;
}
+3 -4
View File
@@ -1,5 +1,5 @@
import { ChatInputCommandInteraction } from 'discord.js';
import { TreeTypeString } from '../../components/Tanks';
import { TreeType } from '../../components/Tanks';
import resolveTankId from '../blitz/resolveTankId';
import { StatFilters } from '../statistics/filterStats';
@@ -13,9 +13,8 @@ export async function getFiltersFromCommand(
tier: parseInt(interaction.options.getString('tier') ?? '0') || undefined,
tankType: interaction.options.getString('tank-type') ?? undefined,
treeType:
(interaction.options.getString('tree-type') as
| TreeTypeString
| undefined) ?? undefined,
(interaction.options.getString('tree-type') as TreeType | undefined) ??
undefined,
tank: tankRaw === null ? undefined : await resolveTankId(tankRaw),
} satisfies StatFilters;
}