feat: add commands command

This commit is contained in:
2026-01-14 02:32:03 -03:00
parent 4033b6f6b5
commit 4fbf308650
+32
View File
@@ -0,0 +1,32 @@
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from "discord.js";
import { Command } from "../../commands";
import { Bot } from "../../bot";
const builder = new SlashCommandBuilder()
.setName('commands')
.setDescription('Shows a list of all the commands.');
const cmd: Command = {
name: builder.name,
builder: builder,
execute: async (interaction: ChatInputCommandInteraction): Promise<void> => {
const responseEmbed = new EmbedBuilder()
.setColor("Blurple")
.setTitle("Command List");
const bot = Bot.get;
bot.getCategories().forEach(({ info, commands }) => {
const fieldBody = commands
.filter(({ builder }) => builder)
.map(({ builder }) => `• **${builder?.name}** - ${builder?.description}`)
.join("\n");
responseEmbed.addFields({ name: info.name, value: fieldBody });
});
await interaction.reply({ embeds: [responseEmbed] });
}
};
export default cmd;