From 4fbf308650b06c7e5058fdbebe6712c9727ca53b Mon Sep 17 00:00:00 2001 From: neru Date: Wed, 14 Jan 2026 02:32:03 -0300 Subject: [PATCH] feat: add commands command --- src/commands/general/cmds.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/commands/general/cmds.ts diff --git a/src/commands/general/cmds.ts b/src/commands/general/cmds.ts new file mode 100644 index 0000000..0a167b5 --- /dev/null +++ b/src/commands/general/cmds.ts @@ -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 => { + 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; \ No newline at end of file