fix: rating command seasonal fix

This commit is contained in:
TrèsAbhi committed 2024-06-06 19:21:06 -05:00
1 parent e5c9c780e9
commit 721bfd9ea2
3 files changed
+73 -70

No files matched your search

+8 -5
View File
@@ -42,9 +42,16 @@ export const ratingCommand = new Promise<CommandRegistry>((resolve) => {
const { id, region } = await resolvePlayerFromCommand(interaction);
const clan = (await getClanAccountInfo(region, id, ['clan']))?.clan;
const clanImage = clan ? emblemURL(clan.emblem_set_id) : undefined;
const ratingInfo = await getRatingInfo(region);
if (ratingInfo.detail) {
throw new Error(`Rating info not available for ${region}`);
}
const leaderboard = await getArchivedRatingMidnightLeaderboard(
region,
53,
ratingInfo.current_season,
);
if (leaderboard?.format === BkrlFormat.Base) {
@@ -53,7 +60,6 @@ export const ratingCommand = new Promise<CommandRegistry>((resolve) => {
);
}
const ratingInfo = await getRatingInfo(region);
const accountInfo = await getAccountInfo(region, id, [
'statistics.rating',
]);
@@ -66,9 +72,6 @@ export const ratingCommand = new Promise<CommandRegistry>((resolve) => {
const [statsB2] = (await getRatingNeighbors(region, id, 0)).neighbors;
const league = getLeagueFromScore(statsB2.score);
if (ratingInfo.detail) {
throw new Error(`Rating info not available for ${region}`);
}
if (!statsA) {
return t`bot.commands.rating.errors.unrecorded_stats`;
}