fix: rating command seasonal fix

This commit is contained in:
TrèsAbhi committed 2024-06-06 19:00:37 -05:00
1 parent c943baf6f3
commit 30b59fff02
3 files changed
+73 -70

No files matched your search

+1 -1
View File
@@ -75,7 +75,7 @@
"react-fuzzysort": "^1.0.1", "react-fuzzysort": "^1.0.1",
"react-promise-suspense": "^0.3.4", "react-promise-suspense": "^0.3.4",
"satori": "^0.10.13", "satori": "^0.10.13",
"sharp": "^0.33.3", "sharp": "^0.33.4",
"three": "0.159.0", "three": "0.159.0",
"three-stdlib": "^2.29.4", "three-stdlib": "^2.29.4",
"vite-node": "^0.34.5", "vite-node": "^0.34.5",
+8 -5
View File
@@ -42,9 +42,16 @@ export const ratingCommand = new Promise<CommandRegistry>((resolve) => {
const { id, region } = await resolvePlayerFromCommand(interaction); const { id, region } = await resolvePlayerFromCommand(interaction);
const clan = (await getClanAccountInfo(region, id, ['clan']))?.clan; const clan = (await getClanAccountInfo(region, id, ['clan']))?.clan;
const clanImage = clan ? emblemURL(clan.emblem_set_id) : undefined; 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( const leaderboard = await getArchivedRatingMidnightLeaderboard(
region, region,
53, ratingInfo.current_season,
); );
if (leaderboard?.format === BkrlFormat.Base) { 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, [ const accountInfo = await getAccountInfo(region, id, [
'statistics.rating', 'statistics.rating',
]); ]);
@@ -66,9 +72,6 @@ export const ratingCommand = new Promise<CommandRegistry>((resolve) => {
const [statsB2] = (await getRatingNeighbors(region, id, 0)).neighbors; const [statsB2] = (await getRatingNeighbors(region, id, 0)).neighbors;
const league = getLeagueFromScore(statsB2.score); const league = getLeagueFromScore(statsB2.score);
if (ratingInfo.detail) {
throw new Error(`Rating info not available for ${region}`);
}
if (!statsA) { if (!statsA) {
return t`bot.commands.rating.errors.unrecorded_stats`; return t`bot.commands.rating.errors.unrecorded_stats`;
} }
+64 -64
View File
@@ -427,10 +427,10 @@
"@docsearch/css" "3.5.2" "@docsearch/css" "3.5.2"
algoliasearch "^4.19.1" algoliasearch "^4.19.1"
"@emnapi/runtime@^1.1.0": "@emnapi/runtime@^1.1.1":
version "1.1.1" version "1.2.0"
resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.1.1.tgz#697d02276ca6f49bafe6fd01c9df0034818afa98" resolved "https://registry.yarnpkg.com/@emnapi/runtime/-/runtime-1.2.0.tgz#71d018546c3a91f3b51106530edbc056b9f2f2e3"
integrity sha512-3bfqkzuR1KLx57nZfjr2NLnFOobvyS0aTszaEGCGqmYMVDRaGvgIZbjGSV/MHSSmLgQ/b9JFHQ5xm5WRZYd+XQ== integrity sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==
dependencies: dependencies:
tslib "^2.4.0" tslib "^2.4.0"
@@ -618,17 +618,17 @@
dependencies: dependencies:
property-graph "^1.3.1" property-graph "^1.3.1"
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.3.tgz#2bbf676be830c5a9ae7d9294f201c9151535badd" resolved "https://registry.yarnpkg.com/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.4.tgz#a1cf4a7febece334f16e0328b9689f05797d7aec"
integrity sha512-FaNiGX1MrOuJ3hxuNzWgsT/mg5OHG/Izh59WW2mk1UwYHUwtfbhk5QNKYZgxf0pLOhx9ctGiGa2OykD71vOnSw== integrity sha512-p0suNqXufJs9t3RqLBO6vvrgr5OhgbWp76s5gTRvdmxmuv9E1rcaqGUsl3l4mKVmXPkTkTErXediAui4x+8PSA==
optionalDependencies: optionalDependencies:
"@img/sharp-libvips-darwin-arm64" "1.0.2" "@img/sharp-libvips-darwin-arm64" "1.0.2"
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.3.tgz#c59567b141eb676e884066f76091a2673120c3f5" resolved "https://registry.yarnpkg.com/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.4.tgz#f77be2d7c3609d3e77cd337b199a772e07b87bd2"
integrity sha512-2QeSl7QDK9ru//YBT4sQkoq7L0EAJZA3rtV+v9p8xTKl4U1bUqTIaCnoC7Ctx2kCjQgwFXDasOtPTCT8eCTXvw== integrity sha512-0l7yRObwtTi82Z6ebVI2PnHT8EB2NxBgpK2MiKJZJ7cz32R4lxd001ecMhzzsZig3Yv9oclvqqdV93jo9hy+Dw==
optionalDependencies: optionalDependencies:
"@img/sharp-libvips-darwin-x64" "1.0.2" "@img/sharp-libvips-darwin-x64" "1.0.2"
@@ -672,64 +672,64 @@
resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.2.tgz#4309474bd8b728a61af0b3b4fad0c476b5f3ccbe" resolved "https://registry.yarnpkg.com/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.2.tgz#4309474bd8b728a61af0b3b4fad0c476b5f3ccbe"
integrity sha512-VI94Q6khIHqHWNOh6LLdm9s2Ry4zdjWJwH56WoiJU7NTeDwyApdZZ8c+SADC8OH98KWNQXnE01UdJ9CSfZvwZw== integrity sha512-VI94Q6khIHqHWNOh6LLdm9s2Ry4zdjWJwH56WoiJU7NTeDwyApdZZ8c+SADC8OH98KWNQXnE01UdJ9CSfZvwZw==
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.3.tgz#a1f788ddf49ed63509dd37d4b01e571fe7f189d5" resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.4.tgz#bd390113e256487041411b988ded13a26cfc5f95"
integrity sha512-Zf+sF1jHZJKA6Gor9hoYG2ljr4wo9cY4twaxgFDvlG0Xz9V7sinsPp8pFd1XtlhTzYo0IhDbl3rK7P6MzHpnYA== integrity sha512-2800clwVg1ZQtxwSoTlHvtm9ObgAax7V6MTAB/hDT945Tfyy3hVkmiHpeLPCKYqYR1Gcmv1uDZ3a4OFwkdBL7Q==
optionalDependencies: optionalDependencies:
"@img/sharp-libvips-linux-arm64" "1.0.2" "@img/sharp-libvips-linux-arm64" "1.0.2"
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.3.tgz#661b0671ed7f740fd06821ce15050ba23f1d0523" resolved "https://registry.yarnpkg.com/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.4.tgz#14ecc81f38f75fb4cd7571bc83311746d6745fca"
integrity sha512-Q7Ee3fFSC9P7vUSqVEF0zccJsZ8GiiCJYGWDdhEjdlOeS9/jdkyJ6sUSPj+bL8VuOYFSbofrW0t/86ceVhx32w== integrity sha512-RUgBD1c0+gCYZGCCe6mMdTiOFS0Zc/XrN0fYd6hISIKcDUbAW5NtSQW9g/powkrXYm6Vzwd6y+fqmExDuCdHNQ==
optionalDependencies: optionalDependencies:
"@img/sharp-libvips-linux-arm" "1.0.2" "@img/sharp-libvips-linux-arm" "1.0.2"
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.3.tgz#8719341d3931a297df1a956c02ee003736fa8fac" resolved "https://registry.yarnpkg.com/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.4.tgz#119e8081e2c6741b5ac908fe02244e4c559e525f"
integrity sha512-vFk441DKRFepjhTEH20oBlFrHcLjPfI8B0pMIxGm3+yilKyYeHEVvrZhYFdqIseSclIqbQ3SnZMwEMWonY5XFA== integrity sha512-h3RAL3siQoyzSoH36tUeS0PDmb5wINKGYzcLB5C6DIiAn2F3udeFAum+gj8IbA/82+8RGCTn7XW8WTFnqag4tQ==
optionalDependencies: optionalDependencies:
"@img/sharp-libvips-linux-s390x" "1.0.2" "@img/sharp-libvips-linux-s390x" "1.0.2"
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.3.tgz#dbd860b4aa16e7e25727c7e05b411132b58d017d" resolved "https://registry.yarnpkg.com/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.4.tgz#21d4c137b8da9a313b069ff5c920ded709f853d7"
integrity sha512-Q4I++herIJxJi+qmbySd072oDPRkCg/SClLEIDh5IL9h1zjhqjv82H0Seupd+q2m0yOfD+/fJnjSoDFtKiHu2g== integrity sha512-GoR++s0XW9DGVi8SUGQ/U4AeIzLdNjHka6jidVwapQ/JebGVQIpi52OdyxCNVRE++n1FCLzjDovJNozif7w/Aw==
optionalDependencies: optionalDependencies:
"@img/sharp-libvips-linux-x64" "1.0.2" "@img/sharp-libvips-linux-x64" "1.0.2"
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.3.tgz#25b3fbfe9b6fa32d773422d878d8d84f3f6afceb" resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.4.tgz#f3fde68fd67b85a32da6f1155818c3b58b8e7ae0"
integrity sha512-qnDccehRDXadhM9PM5hLvcPRYqyFCBN31kq+ErBSZtZlsAc1U4Z85xf/RXv1qolkdu+ibw64fUDaRdktxTNP9A== integrity sha512-nhr1yC3BlVrKDTl6cO12gTpXMl4ITBUZieehFvMntlCXFzH2bvKG76tBL2Y/OqhupZt81pR7R+Q5YhJxW0rGgQ==
optionalDependencies: optionalDependencies:
"@img/sharp-libvips-linuxmusl-arm64" "1.0.2" "@img/sharp-libvips-linuxmusl-arm64" "1.0.2"
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.3.tgz#1e533e44abf2e2d427428ed49294ddba4eb11456" resolved "https://registry.yarnpkg.com/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.4.tgz#44373724aecd7b69900e0578228144e181db7892"
integrity sha512-Jhchim8kHWIU/GZ+9poHMWRcefeaxFIs9EBqf9KtcC14Ojk6qua7ghKiPs0sbeLbLj/2IGBtDcxHyjCdYWkk2w== integrity sha512-uCPTku0zwqDmZEOi4ILyGdmW76tH7dm8kKlOIV1XC5cLyJ71ENAAqarOHQh0RLfpIpbV5KOpXzdU6XkJtS0daw==
optionalDependencies: optionalDependencies:
"@img/sharp-libvips-linuxmusl-x64" "1.0.2" "@img/sharp-libvips-linuxmusl-x64" "1.0.2"
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-wasm32/-/sharp-wasm32-0.33.3.tgz#340006047a77df0744db84477768bbca6327b4b4" resolved "https://registry.yarnpkg.com/@img/sharp-wasm32/-/sharp-wasm32-0.33.4.tgz#88e3f18d7e7cd8cfe1af98e9963db4d7b6491435"
integrity sha512-68zivsdJ0koE96stdUfM+gmyaK/NcoSZK5dV5CAjES0FUXS9lchYt8LAB5rTbM7nlWtxaU/2GON0HVN6/ZYJAQ== integrity sha512-Bmmauh4sXUsUqkleQahpdNXKvo+wa1V9KhT2pDA4VJGKwnKMJXiSTGphn0gnJrlooda0QxCtXc6RX1XAU6hMnQ==
dependencies: dependencies:
"@emnapi/runtime" "^1.1.0" "@emnapi/runtime" "^1.1.1"
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.3.tgz#0fdc49ab094ed0151ec8347afac7917aa5fc5145" resolved "https://registry.yarnpkg.com/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.4.tgz#b1c772dd2952e983980b1eb85808fa8129484d46"
integrity sha512-CyimAduT2whQD8ER4Ux7exKrtfoaUiVr7HG0zZvO0XTFn2idUWljjxv58GxNTkFb8/J9Ub9AqITGkJD6ZginxQ== integrity sha512-99SJ91XzUhYHbx7uhK3+9Lf7+LjwMGQZMDlO/E/YVJ7Nc3lyDFZPGhjwiYdctoH2BOzW9+TnfqcaMKt0jHLdqw==
"@img/[email protected].3": "@img/[email protected].4":
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.3.tgz#a94e1028f180666f97fd51e35c4ad092d7704ef0" resolved "https://registry.yarnpkg.com/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.4.tgz#106f911134035b4157ec92a0c154a6b6f88fa4c1"
integrity sha512-viT4fUIDKnli3IfOephGnolMzhz5VaTvDRkYqtZxOMIoMQ4MrAziO7pT1nVnOt2FAm7qW5aa+CCc13aEY6Le0g== integrity sha512-3QLocdTRVIrFNye5YocZl+KKpYKP+fksi1QhmOArgx7GyhIbQp/WrJRu176jm8IxromS7RIkzMiMINVdBtC8Aw==
"@isaacs/cliui@^8.0.2": "@isaacs/cliui@^8.0.2":
version "8.0.2" version "8.0.2"
@@ -5377,17 +5377,17 @@ [email protected]:
resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424"
integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==
sharp@^0.33.3: sharp@^0.33.4:
version "0.33.3" version "0.33.4"
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.33.3.tgz#3342fe0aa5ed45a363e6578fa575c7af366216c2" resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.33.4.tgz#b88e6e843e095c6ab5e1a0c59c4885e580cd8405"
integrity sha512-vHUeXJU1UvlO/BNwTpT0x/r53WkLUVxrmb5JTgW92fdFCFk0ispLMAeu/jPO2vjkXM1fYUi3K7/qcLF47pwM1A== integrity sha512-7i/dt5kGl7qR4gwPRD2biwD2/SvBn3O04J77XKFgL2OnZtQw+AG9wnuS/csmu80nPRHLYE9E41fyEiG8nhH6/Q==
dependencies: dependencies:
color "^4.2.3" color "^4.2.3"
detect-libc "^2.0.3" detect-libc "^2.0.3"
semver "^7.6.0" semver "^7.6.0"
optionalDependencies: optionalDependencies:
"@img/sharp-darwin-arm64" "0.33.3" "@img/sharp-darwin-arm64" "0.33.4"
"@img/sharp-darwin-x64" "0.33.3" "@img/sharp-darwin-x64" "0.33.4"
"@img/sharp-libvips-darwin-arm64" "1.0.2" "@img/sharp-libvips-darwin-arm64" "1.0.2"
"@img/sharp-libvips-darwin-x64" "1.0.2" "@img/sharp-libvips-darwin-x64" "1.0.2"
"@img/sharp-libvips-linux-arm" "1.0.2" "@img/sharp-libvips-linux-arm" "1.0.2"
@@ -5396,15 +5396,15 @@ sharp@^0.33.3:
"@img/sharp-libvips-linux-x64" "1.0.2" "@img/sharp-libvips-linux-x64" "1.0.2"
"@img/sharp-libvips-linuxmusl-arm64" "1.0.2" "@img/sharp-libvips-linuxmusl-arm64" "1.0.2"
"@img/sharp-libvips-linuxmusl-x64" "1.0.2" "@img/sharp-libvips-linuxmusl-x64" "1.0.2"
"@img/sharp-linux-arm" "0.33.3" "@img/sharp-linux-arm" "0.33.4"
"@img/sharp-linux-arm64" "0.33.3" "@img/sharp-linux-arm64" "0.33.4"
"@img/sharp-linux-s390x" "0.33.3" "@img/sharp-linux-s390x" "0.33.4"
"@img/sharp-linux-x64" "0.33.3" "@img/sharp-linux-x64" "0.33.4"
"@img/sharp-linuxmusl-arm64" "0.33.3" "@img/sharp-linuxmusl-arm64" "0.33.4"
"@img/sharp-linuxmusl-x64" "0.33.3" "@img/sharp-linuxmusl-x64" "0.33.4"
"@img/sharp-wasm32" "0.33.3" "@img/sharp-wasm32" "0.33.4"
"@img/sharp-win32-ia32" "0.33.3" "@img/sharp-win32-ia32" "0.33.4"
"@img/sharp-win32-x64" "0.33.3" "@img/sharp-win32-x64" "0.33.4"
shebang-command@^2.0.0: shebang-command@^2.0.0:
version "2.0.0" version "2.0.0"