From b84f2e7adc4e273ca403632333fda43113129654 Mon Sep 17 00:00:00 2001 From: tresabhi Date: Fri, 23 Jun 2023 17:10:18 +0000 Subject: [PATCH] feat: more subcommands for /ping --- src/commands/ping.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/commands/ping.ts b/src/commands/ping.ts index a890f2540..f00b7ca7c 100644 --- a/src/commands/ping.ts +++ b/src/commands/ping.ts @@ -9,12 +9,25 @@ export default { command: new SlashCommandBuilder() .setName('ping') - .setDescription('Check if the bot is alive'), + .setDescription('Check if the bot is alive') + .addSubcommand((option) => + option.setName('blitzkrieg').setDescription('Ping Blitzkrieg'), + ) + .addSubcommand((option) => + option.setName('blitz').setDescription('Ping Blitz'), + ), async execute(interaction) { - const executionStart = new Date().getTime(); - await interaction.editReply('Pong 🏓'); - const executionTime = new Date().getTime() - executionStart; + const subcommand = interaction.options.getSubcommand(); + const executionStart = Date.now(); + + if (subcommand === 'blitzkrieg') { + await interaction.editReply('Pong 🏓'); + } else { + await fetch('https://api.wotblitz.com/'); + } + + const executionTime = Date.now() - executionStart; interaction.editReply(`Pong 🏓 - ${executionTime}ms`); }, } satisfies CommandRegistry;