feat: comp tanks in /tanks

This commit is contained in:
TresAbhi committed 2023-04-27 19:56:02 +00:00
1 parent a3320545d0
commit d78e8bb30c
3 files changed
+50 -14

No files matched your search

+3
View File
@@ -2,11 +2,14 @@
"cSpell.words": [ "cSpell.words": [
"Abhi", "Abhi",
"accountinfo", "accountinfo",
"kranvagn",
"ownedtanks", "ownedtanks",
"SKLLD", "SKLLD",
"Smri", "Smri",
"strvk",
"tankopedia", "tankopedia",
"Unregistering", "Unregistering",
"vickers",
"wargaming", "wargaming",
"winrate" "winrate"
], ],
+45 -12
View File
@@ -5,11 +5,32 @@ import { BLITZ_SERVERS, BlitzServer } from '../constants/servers.js';
import { TanksStats } from '../types/tanksStats.js'; import { TanksStats } from '../types/tanksStats.js';
import getBlitzAccount from '../utilities/getBlitzAccount.js'; import getBlitzAccount from '../utilities/getBlitzAccount.js';
import getWargamingResponse from '../utilities/getWargamingResponse.js'; import getWargamingResponse from '../utilities/getWargamingResponse.js';
import { tankTypeEmojis, tankopedia } from '../utilities/tankopedia.js'; import { TANK_TYPE_EMOJIS, tankopedia } from '../utilities/tankopedia.js';
const COMP_TANKS: Record<number, { niche?: boolean }> = {
// light tanks
24321: {}, // t-100 lt
20257: {}, // sheridan
3649: { niche: true }, // bat chat
19537: { niche: true }, // vickers
// heavy tanks
6145: {}, // is-4
7169: {}, // is-7
10785: {}, // t110e5
12161: {}, // strvk
4481: {}, // kranvagn
22817: {}, // m6 yoh
6225: {}, // fv215b
5425: {}, // wz 113
7297: {}, // 60tp
9489: { niche: true }, // e 100
6753: { niche: true }, // type 71
};
export default { export default {
inProduction: true, inProduction: true,
inDevelopment: false, inDevelopment: true,
inPublic: true, inPublic: true,
command: new SlashCommandBuilder() command: new SlashCommandBuilder()
@@ -64,16 +85,28 @@ export default {
}tanks`, }tanks`,
) )
.setDescription( .setDescription(
tanks.length === 0 `${
? `No tanks found for player in tier ${tier}` tanks.length === 0
: tanks ? `No tanks found for player in tier ${tier}`
.map( : tanks
(tank) => .map(
`${tankTypeEmojis[tank.type]} ${tank.name} ${ (tank) =>
tank.is_premium ? '⭐' : '' `${TANK_TYPE_EMOJIS[tank.type]} ${tank.name} ${
}`, tank.is_premium ? '⭐' : ''
) }${
.join('\n'), COMP_TANKS[tank.tank_id] === undefined
? ''
: '🏆'
}`,
)
.join('\n')
}\n\n**Legend**\n⭐ = Premium/Collector\n${
tier === 10 ? '🏆 = Comp Tank\n' : ''
}${TANK_TYPE_EMOJIS.heavyTank} = Heavy\n${
TANK_TYPE_EMOJIS.mediumTank
} = Medium\n${TANK_TYPE_EMOJIS.lightTank} = Light\n${
TANK_TYPE_EMOJIS['AT-SPG']
} = Tank Destroyer`,
) )
.setColor(SKILLED_COLOR), .setColor(SKILLED_COLOR),
], ],
+2 -2
View File
@@ -32,13 +32,13 @@ export const tankopedia = (await (
await fetch('https://www.blitzstars.com/bs-tankopedia.json') await fetch('https://www.blitzstars.com/bs-tankopedia.json')
).json()) as Tankopedia; ).json()) as Tankopedia;
export const tankTypeNames: Record<TankType, string> = { export const TANK_TYPE_NAMES: Record<TankType, string> = {
'AT-SPG': 'Tank Destroyer', 'AT-SPG': 'Tank Destroyer',
heavyTank: 'Heavy Tank', heavyTank: 'Heavy Tank',
mediumTank: 'Medium Tank', mediumTank: 'Medium Tank',
lightTank: 'Light Tank', lightTank: 'Light Tank',
}; };
export const tankTypeEmojis: Record<TankType, string> = { export const TANK_TYPE_EMOJIS: Record<TankType, string> = {
'AT-SPG': '🔽', 'AT-SPG': '🔽',
heavyTank: '🇭', heavyTank: '🇭',
mediumTank: '🇲', mediumTank: '🇲',