diff --git a/src/commands/debug.ts b/src/commands/debug.ts index ef768d4d6..fbea9e25a 100644 --- a/src/commands/debug.ts +++ b/src/commands/debug.ts @@ -1,6 +1,7 @@ -import { SlashCommandBuilder } from 'discord.js'; import packageJSON from '../../package.json' assert { type: 'json' }; import { client } from '../core/discord/client'; +import { createLocalizedCommand } from '../core/discord/createLocalizedCommand'; +import { translator } from '../core/localization/translator'; import { CommandRegistry } from '../events/interactionCreate'; const executionStart = new Date().getTime(); @@ -9,28 +10,26 @@ export const debugCommand: CommandRegistry = { inProduction: true, inPublic: true, - command: new SlashCommandBuilder() - .setName('debug') - .setDescription('Debug information about the bot'), + command: createLocalizedCommand('debug'), - async handler() { + async handler(interaction) { + const { t } = translator(interaction.locale); const currentTime = new Date().getTime(); const uptime = currentTime - executionStart; const list = [ - ['Version', packageJSON.version], - ['Shard', client.shard?.ids[0] ?? 'default'], + [t`bot.commands.debug.body.version`, packageJSON.version], + [t`bot.commands.debug.body.shard`, client.shard?.ids[0] ?? 'default'], [ - 'Uptime', + t`bot.commands.debug.body.uptime`, `${Math.floor((uptime / 1000 / 60 / 60) % 24)}h ${Math.floor( (uptime / 1000 / 60) % 60, )}m ${Math.floor((uptime / 1000) % 60)}s ${Math.floor( uptime % 1000, )}ms`, ], - ] + ]; + return t`bot.commands.debug.body.title${list .map(([key, value]) => `- ${key}: ${value}`) - .join('\n'); - - return `# Debug\n\n${list}`; + .join('\n')}`; }, }; diff --git a/src/lang/en-US.json b/src/lang/en-US.json index e33bf1bff..daabda4a8 100644 --- a/src/lang/en-US.json +++ b/src/lang/en-US.json @@ -97,6 +97,18 @@ "winrate": "Winrate", "damage": "Damage" } + }, + + "debug": { + "$": "debug", + "description": "Debug information about the bot", + + "body": { + "title": "# Debug\n\n", + "version": "Version", + "shard": "Shard", + "uptime": "Uptime" + } } } },