38 lines
945 B
TypeScript
38 lines
945 B
TypeScript
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;
|