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": [
"Abhi",
"accountinfo",
"kranvagn",
"ownedtanks",
"SKLLD",
"Smri",
"strvk",
"tankopedia",
"Unregistering",
"vickers",
"wargaming",
"winrate"
],
+45 -12
View File
@@ -5,11 +5,32 @@ import { BLITZ_SERVERS, BlitzServer } from '../constants/servers.js';
import { TanksStats } from '../types/tanksStats.js';
import getBlitzAccount from '../utilities/getBlitzAccount.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 {
inProduction: true,
inDevelopment: false,
inDevelopment: true,
inPublic: true,
command: new SlashCommandBuilder()
@@ -64,16 +85,28 @@ export default {
}tanks`,
)
.setDescription(
tanks.length === 0
? `No tanks found for player in tier ${tier}`
: tanks
.map(
(tank) =>
`${tankTypeEmojis[tank.type]} ${tank.name} ${
tank.is_premium ? '⭐' : ''
}`,
)
.join('\n'),
`${
tanks.length === 0
? `No tanks found for player in tier ${tier}`
: tanks
.map(
(tank) =>
`${TANK_TYPE_EMOJIS[tank.type]} ${tank.name} ${
tank.is_premium ? '⭐' : ''
}${
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),
],
+2 -2
View File
@@ -32,13 +32,13 @@ export const tankopedia = (await (
await fetch('https://www.blitzstars.com/bs-tankopedia.json')
).json()) as Tankopedia;
export const tankTypeNames: Record<TankType, string> = {
export const TANK_TYPE_NAMES: Record<TankType, string> = {
'AT-SPG': 'Tank Destroyer',
heavyTank: 'Heavy Tank',
mediumTank: 'Medium Tank',
lightTank: 'Light Tank',
};
export const tankTypeEmojis: Record<TankType, string> = {
export const TANK_TYPE_EMOJIS: Record<TankType, string> = {
'AT-SPG': '🔽',
heavyTank: '🇭',
mediumTank: '🇲',