mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
|
import packageJSON from '../../package.json' assert { type: 'json' };
|
|
import { SKILLED_COLOR } from '../constants/colors.js';
|
|
import { tankopedia } from '../core/blitzstars/tankopedia.js';
|
|
import cmdName from '../core/interaction/cmdName.js';
|
|
import getClientId from '../core/process/getClientId.js';
|
|
import { client } from '../index.js';
|
|
import { CommandRegistry } from '../events/interactionCreate.js';
|
|
|
|
const executionStart = new Date().getTime();
|
|
|
|
export default {
|
|
inProduction: true,
|
|
inDevelopment: false,
|
|
inPublic: true,
|
|
|
|
command: new SlashCommandBuilder()
|
|
.setName(cmdName('debug'))
|
|
.setDescription('Debug information about the bot'),
|
|
|
|
async execute(interaction) {
|
|
const currentTime = new Date().getTime();
|
|
const uptime = currentTime - executionStart;
|
|
|
|
await interaction.editReply({
|
|
embeds: [
|
|
new EmbedBuilder()
|
|
.setTitle(`${client.user?.username} debug information`)
|
|
.setColor(SKILLED_COLOR)
|
|
.setDescription(
|
|
`**Version**: ${packageJSON.version}\n**Uptime**: ${Math.floor(
|
|
uptime / 1000 / 60 / 60 / 24,
|
|
)}d ${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\n**Tankopedia**: ${
|
|
tankopedia ? 'cached' : 'not cached'
|
|
}\n**Client ID**: ${getClientId()}\n**Tag**: ${
|
|
interaction.client.user.tag
|
|
}`,
|
|
),
|
|
],
|
|
});
|
|
|
|
console.log("Displaying bot's debug information");
|
|
},
|
|
} satisfies CommandRegistry;
|