feat: added all buttons to dynamic commands

This commit is contained in:
TresAbhi committed 2023-06-28 18:45:14 +00:00
1 parent dd39563d6d
commit d1d8aad6c7
9 files changed
+157 -57

No files matched your search

+4 -4
View File
@@ -21,7 +21,7 @@ export default async function evolution<Type extends StatType>(
type: Type,
{ start, end, evolutionName }: ResolvedPeriod,
{ server, id }: ResolvedPlayer,
tankId: Type extends 'tank' ? number : never,
tankId: Type extends 'tank' ? number : null,
) {
let nameDiscriminator: string | undefined;
let image: string | undefined;
@@ -38,8 +38,8 @@ export default async function evolution<Type extends StatType>(
? `https://wotblitz-gc.gcdn.co/icons/clanEmblems1x/clan-icon-v2-${clan.emblem_set_id}.png`
: undefined;
} else {
nameDiscriminator = `(${resolveTankName(tankId)})`;
image = tankopedia[tankId].images.normal;
nameDiscriminator = `(${resolveTankName(tankId!)})`;
image = tankopedia[tankId!].images.normal;
}
let histories: Histories;
@@ -53,7 +53,7 @@ export default async function evolution<Type extends StatType>(
});
} else {
histories = await getTankHistories(server, id, {
tankId,
tankId: tankId!,
start,
end,
includeLatestHistories: true,
+6 -6
View File
@@ -28,7 +28,7 @@ export default async function stats<Type extends StatType>(
type: Type,
{ start, end, statsName }: ResolvedPeriod,
{ server, id }: ResolvedPlayer,
tankId: Type extends 'tank' ? number : never,
tankId: Type extends 'tank' ? number : null,
) {
let nameDiscriminator: string | undefined;
let image: string | undefined;
@@ -45,8 +45,8 @@ export default async function stats<Type extends StatType>(
? `https://wotblitz-gc.gcdn.co/icons/clanEmblems1x/clan-icon-v2-${clan.emblem_set_id}.png`
: undefined;
} else if (type === 'tank') {
nameDiscriminator = `(${resolveTankName(tankId)})`;
image = tankopedia[tankId].images.normal;
nameDiscriminator = `(${resolveTankName(tankId!)})`;
image = tankopedia[tankId!].images.normal;
}
const tankStats = await getTankStatsDiffed(server, id, start, end);
@@ -112,11 +112,11 @@ export default async function stats<Type extends StatType>(
{},
);
} else {
stats = tankStats[tankId];
stats = tankStats[tankId!];
supplementaryStats = {
WN8: calculateWN8(tankAverages[tankId].all, tankStats[tankId]),
tier: tankopedia[tankId].tier,
WN8: calculateWN8(tankAverages[tankId!].all, tankStats[tankId!]),
tier: tankopedia[tankId!].tier,
};
}