feat: BlitzServer type

This commit is contained in:
TresAbhi committed 2023-04-25 23:14:23 +00:00
1 parent 6870b59b3b
commit 8b77baccab
6 files changed
+27 -33

No files matched your search

+5 -7
View File
@@ -5,7 +5,7 @@ import {
SlashCommandBuilder,
} from 'discord.js';
import { NEGATIVE_COLOR, POSITIVE_COLOR } from '../constants/colors.js';
import { SERVERS } from '../constants/servers.js';
import { BLITZ_SERVERS, BlitzServer } from '../constants/servers.js';
import blitzLinks from '../utilities/blitzLinks.js';
import getBlitzAccount from '../utilities/getBlitzAccount.js';
import getBlitzStarsAccount from '../utilities/getBlitzStarsAccount.js';
@@ -26,9 +26,7 @@ export async function execute(
interaction: ChatInputCommandInteraction<CacheType>,
) {
const ign = interaction.options.getString('ign')!;
const server = interaction.options.getString(
'server',
) as keyof typeof SERVERS;
const server = interaction.options.getString('server') as BlitzServer;
const clan = interaction.options.getString('clan') as keyof typeof CLANS;
getBlitzAccount(interaction, ign, server, async (account) => {
@@ -140,9 +138,9 @@ export const data = new SlashCommandBuilder()
.setName('server')
.setDescription('The Blitz server you are in')
.addChoices(
{ name: SERVERS.com, value: 'com' },
{ name: SERVERS.eu, value: 'eu' },
{ name: SERVERS.asia, value: 'asia' },
{ name: BLITZ_SERVERS.com, value: 'com' },
{ name: BLITZ_SERVERS.eu, value: 'eu' },
{ name: BLITZ_SERVERS.asia, value: 'asia' },
)
.setRequired(true),
)
+6 -8
View File
@@ -4,19 +4,17 @@ import {
EmbedBuilder,
SlashCommandBuilder,
} from 'discord.js';
import fetch from 'node-fetch';
import { SKILLED_COLOR } from '../constants/colors.js';
import { SERVERS } from '../constants/servers.js';
import { BLITZ_SERVERS, BlitzServer } from '../constants/servers.js';
import { TanksStats } from '../types/tanksStats.js';
import getBlitzAccount from '../utilities/getBlitzAccount.js';
import { tankTypeEmojis, tankopedia } from '../utilities/tankopedia.js';
import fetch from 'node-fetch';
export async function execute(
interaction: ChatInputCommandInteraction<CacheType>,
) {
const server = interaction.options.getString(
'server',
) as keyof typeof SERVERS;
const server = interaction.options.getString('server') as BlitzServer;
const ign = interaction.options.getString('ign')!;
let tier = interaction.options.getNumber('tier');
@@ -92,9 +90,9 @@ export const data = new SlashCommandBuilder()
.setDescription('The Blitz server you are in')
.setRequired(true)
.addChoices(
{ name: SERVERS.com, value: 'com' },
{ name: SERVERS.eu, value: 'eu' },
{ name: SERVERS.asia, value: 'asia' },
{ name: BLITZ_SERVERS.com, value: 'com' },
{ name: BLITZ_SERVERS.eu, value: 'eu' },
{ name: BLITZ_SERVERS.asia, value: 'asia' },
),
)
.addStringOption((option) =>
+5 -7
View File
@@ -5,7 +5,7 @@ import {
SlashCommandBuilder,
} from 'discord.js';
import { SKILLED_COLOR } from '../constants/colors.js';
import { SERVERS } from '../constants/servers.js';
import { BLITZ_SERVERS, BlitzServer } from '../constants/servers.js';
import blitzLinks from '../utilities/blitzLinks.js';
import getBlitzAccount from '../utilities/getBlitzAccount.js';
import getBlitzStarsAccount from '../utilities/getBlitzStarsAccount.js';
@@ -15,9 +15,7 @@ export async function execute(
interaction: ChatInputCommandInteraction<CacheType>,
) {
const ign = interaction.options.getString('ign')!;
const server = interaction.options.getString(
'server',
) as keyof typeof SERVERS;
const server = interaction.options.getString('server') as BlitzServer;
const period = interaction.options.getString('period')! as
| '30'
| '90'
@@ -111,9 +109,9 @@ export const data = new SlashCommandBuilder()
.setName('server')
.setDescription('The Blitz server you are in')
.addChoices(
{ name: SERVERS.com, value: 'com' },
{ name: SERVERS.eu, value: 'eu' },
{ name: SERVERS.asia, value: 'asia' },
{ name: BLITZ_SERVERS.com, value: 'com' },
{ name: BLITZ_SERVERS.eu, value: 'eu' },
{ name: BLITZ_SERVERS.asia, value: 'asia' },
)
.setRequired(true),
)
+5 -7
View File
@@ -7,7 +7,7 @@ import {
import fetch from 'node-fetch';
import discord from '../../discord.json' assert { type: 'json' };
import { NEGATIVE_COLOR, POSITIVE_COLOR } from '../constants/colors.js';
import { SERVERS } from '../constants/servers.js';
import { BLITZ_SERVERS, BlitzServer } from '../constants/servers.js';
import { PlayerClanData } from '../types/playerClanData.js';
import getBlitzAccount from '../utilities/getBlitzAccount.js';
@@ -15,9 +15,7 @@ export async function execute(
interaction: ChatInputCommandInteraction<CacheType>,
) {
const ign = interaction.options.getString('ign')!;
const server = interaction.options.getString(
'server',
) as keyof typeof SERVERS;
const server = interaction.options.getString('server') as BlitzServer;
getBlitzAccount(interaction, ign, server, async (account) => {
// good match
@@ -79,9 +77,9 @@ export const data = new SlashCommandBuilder()
.setDescription('The Blitz server you are in')
.setRequired(true)
.addChoices(
{ name: SERVERS.com, value: 'com' },
{ name: SERVERS.eu, value: 'eu' },
{ name: SERVERS.asia, value: 'asia' },
{ name: BLITZ_SERVERS.com, value: 'com' },
{ name: BLITZ_SERVERS.eu, value: 'eu' },
{ name: BLITZ_SERVERS.asia, value: 'asia' },
),
)
.addStringOption((option) =>