refactor: implement command class structure for better organization and error handling; update existing commands to extend from the new base class

This commit is contained in:
2025-03-25 11:17:26 -04:00
parent 69dc616668
commit 5bc0d98334
9 changed files with 351 additions and 244 deletions
+9 -5
View File
@@ -7,10 +7,14 @@
// (at your option) any later version.
import { SlashCommandBuilder, EmbedBuilder } from 'discord.js';
import Command from '../utils/Command.js';
export default {
data: new SlashCommandBuilder().setName('help').setDescription('Lists all available commands'),
async execute(interaction) {
export default class HelpCommand extends Command {
defineCommand() {
return new SlashCommandBuilder().setName('help').setDescription('Lists all available commands');
}
async run(interaction) {
const { commands } = interaction.client;
const helpEmbed = new EmbedBuilder()
.setColor('#5dc67b')
@@ -26,5 +30,5 @@ export default {
});
await interaction.reply({ embeds: [helpEmbed], ephemeral: true });
},
};
}
}