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;
+41
View File
@@ -0,0 +1,41 @@
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
import discord from '../../discord.json' assert { type: 'json' };
import {
CommandRegistry,
guildCommands,
publicCommands,
} from '../behaviors/interactionCreate.js';
import { SKILLED_COLOR } from '../constants/colors.js';
export default {
inProduction: false,
inDevelopment: true,
inPublic: true,
command: new SlashCommandBuilder()
.setName('help')
.setDescription('All the help you need about the bot'),
async execute(interaction) {
await interaction.reply({
embeds: [
new EmbedBuilder()
.setTitle('Skilled Bot help')
.setColor(SKILLED_COLOR)
.setDescription(
`**About**\nSkilled Bot provides many useful commands that automate many mundane tasks and provide statistics in just the right may.\Made by TresAbhi from the Skilled [SKLLD] clan.\nGitHub: https://github.com/sklld/bot\nSkilled: ADD THE LINK HERE I FORGOT\n\n**Commands**\n${(interaction.guildId ===
discord.guild_id
? [...guildCommands, ...publicCommands]
: publicCommands
)
.map((command) => `**/${command.name}**: ${command.description}`)
.join(
'\n',
)})}\n\n*I am a new bot; I may make mistakes and go offline from time to time.*`,
),
],
});
console.log('Displaying help information');
},
} satisfies CommandRegistry;
+1 -1
View File
@@ -11,7 +11,7 @@ const DEFAULT_THRESHOLD = 7;
export default {
inProduction: true,
inDevelopment: true,
inDevelopment: false,
inPublic: true,
command: new SlashCommandBuilder()
+5 -1
View File
@@ -57,7 +57,7 @@ export default {
(tankData) => tankopedia.data[tankData.tank_id],
).filter((tank) => tank.tier === tier);
interaction.reply({
await interaction.reply({
embeds: [
new EmbedBuilder()
.setTitle(
@@ -80,6 +80,10 @@ export default {
.setColor(SKILLED_COLOR),
],
});
console.log(
`Displaying ${account.nickname}'s owned tanks in tier ${tier}`,
);
});
},
} satisfies CommandRegistry;