From d78e8bb30cf10e649fb02392a25d3749b8cde161 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Thu, 27 Apr 2023 19:55:42 +0000 Subject: [PATCH] feat: comp tanks in /tanks --- .vscode/settings.json | 3 ++ src/commands/tanks.ts | 57 +++++++++++++++++++++++++++++-------- src/utilities/tankopedia.ts | 4 +-- 3 files changed, 50 insertions(+), 14 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4ceaf27d9..f115c42b5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,11 +2,14 @@ "cSpell.words": [ "Abhi", "accountinfo", + "kranvagn", "ownedtanks", "SKLLD", "Smri", + "strvk", "tankopedia", "Unregistering", + "vickers", "wargaming", "winrate" ], diff --git a/src/commands/tanks.ts b/src/commands/tanks.ts index 822b956d9..20563d7e9 100644 --- a/src/commands/tanks.ts +++ b/src/commands/tanks.ts @@ -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 = { + // 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), ], diff --git a/src/utilities/tankopedia.ts b/src/utilities/tankopedia.ts index 5f9fb84b6..4fe8103f3 100644 --- a/src/utilities/tankopedia.ts +++ b/src/utilities/tankopedia.ts @@ -32,13 +32,13 @@ export const tankopedia = (await ( await fetch('https://www.blitzstars.com/bs-tankopedia.json') ).json()) as Tankopedia; -export const tankTypeNames: Record = { +export const TANK_TYPE_NAMES: Record = { 'AT-SPG': 'Tank Destroyer', heavyTank: 'Heavy Tank', mediumTank: 'Medium Tank', lightTank: 'Light Tank', }; -export const tankTypeEmojis: Record = { +export const TANK_TYPE_EMOJIS: Record = { 'AT-SPG': 'šŸ”½', heavyTank: 'šŸ‡­', mediumTank: 'šŸ‡²',