feat: /debug and /help

This commit is contained in:
TresAbhi committed 2023-04-26 14:23:42 +00:00
1 parent 91260aed2a
commit c37b90caac
11 files changed
+110 -10

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import packageJSON from '../../package.json' assert { type: 'json' };
import { CommandRegistry } from '../behaviors/interactionCreate.js';
import { SKILLED_COLOR } from '../constants/colors.js';
import { executionStart } from '../index.js';
import getClientId from '../utilities/getClientId.js';
import { tankopedia } from '../utilities/tankopedia.js';
export default {
inProduction: false,
inDevelopment: true,
inPublic: true,
command: new SlashCommandBuilder()
.setName('debug')
.setDescription('Debug information about the bot'),
async execute(interaction) {
const currentTime = new Date().getTime();
const uptime = currentTime - executionStart;
await interaction.reply({
embeds: [
new EmbedBuilder()
.setTitle('Skilled Bot 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;