mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
fix: /statsfull now uses null tankId when not available
This commit is contained in:
1 parent
d1d8aad6c7
commit
c2d2d076f0
2 files changed
+7
-7
No files matched your search
@@ -35,7 +35,7 @@ export default {
|
|||||||
const player = await resolvePlayerFromCommand(interaction);
|
const player = await resolvePlayerFromCommand(interaction);
|
||||||
const period = resolvePeriodFromCommand(interaction);
|
const period = resolvePeriodFromCommand(interaction);
|
||||||
const tankIdRaw = interaction.options.getString('tank')!;
|
const tankIdRaw = interaction.options.getString('tank')!;
|
||||||
const tankId = commandGroup === 'tank' ? resolveTankId(tankIdRaw) : 0;
|
const tankId = commandGroup === 'tank' ? resolveTankId(tankIdRaw) : null;
|
||||||
const start = interaction.options.getInteger('start');
|
const start = interaction.options.getInteger('start');
|
||||||
const end = interaction.options.getInteger('end');
|
const end = interaction.options.getInteger('end');
|
||||||
const path = interactionToURL(interaction, {
|
const path = interactionToURL(interaction, {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export default async function statsfull<Type extends StatType>(
|
|||||||
type: Type,
|
type: Type,
|
||||||
{ start, end, statsName }: ResolvedPeriod,
|
{ start, end, statsName }: ResolvedPeriod,
|
||||||
{ server, id }: ResolvedPlayer,
|
{ server, id }: ResolvedPlayer,
|
||||||
tankId: Type extends 'tank' ? number : never,
|
tankId: Type extends 'tank' ? number : null,
|
||||||
) {
|
) {
|
||||||
let nameDiscriminator: string | undefined;
|
let nameDiscriminator: string | undefined;
|
||||||
let image: string | undefined;
|
let image: string | undefined;
|
||||||
@@ -45,8 +45,8 @@ export default async function statsfull<Type extends StatType>(
|
|||||||
? `https://wotblitz-gc.gcdn.co/icons/clanEmblems1x/clan-icon-v2-${clan.emblem_set_id}.png`
|
? `https://wotblitz-gc.gcdn.co/icons/clanEmblems1x/clan-icon-v2-${clan.emblem_set_id}.png`
|
||||||
: undefined;
|
: undefined;
|
||||||
} else if (type === 'tank') {
|
} else if (type === 'tank') {
|
||||||
nameDiscriminator = `(${resolveTankName(tankId)})`;
|
nameDiscriminator = `(${resolveTankName(tankId!)})`;
|
||||||
image = tankopedia[tankId].images.normal;
|
image = tankopedia[tankId!].images.normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
const tankStats = await getTankStatsDiffed(server, id, start, end);
|
const tankStats = await getTankStatsDiffed(server, id, start, end);
|
||||||
@@ -112,11 +112,11 @@ export default async function statsfull<Type extends StatType>(
|
|||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
stats = tankStats[tankId];
|
stats = tankStats[tankId!];
|
||||||
|
|
||||||
supplementaryStats = {
|
supplementaryStats = {
|
||||||
WN8: calculateWN8(tankAverages[tankId].all, tankStats[tankId]),
|
WN8: calculateWN8(tankAverages[tankId!].all, tankStats[tankId!]),
|
||||||
tier: tankopedia[tankId].tier,
|
tier: tankopedia[tankId!].tier,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user