Add currency commands and polish utilities
This commit is contained in:
+15
-11
@@ -1,23 +1,27 @@
|
||||
const { SlashCommandBuilder} = require("discord.js");
|
||||
const { SlashCommandBuilder, EmbedBuilder } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('help')
|
||||
.setDescription('Gives all available commands.'),
|
||||
async execute(interaction) {
|
||||
// Map over the full command objects to get names and descriptions
|
||||
const commandDetails = interaction.client.commands.map(cmd => ({
|
||||
name: cmd.data.name,
|
||||
description: cmd.data.description,
|
||||
}));
|
||||
const commandDetails = interaction.client.commands
|
||||
.map(cmd => ({
|
||||
name: cmd.data.name,
|
||||
description: cmd.data.description,
|
||||
}))
|
||||
.sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
// Format the commands into a user-friendly help message
|
||||
const helpMessage = commandDetails
|
||||
.map(detail => `/${detail.name} - ${detail.description}`)
|
||||
.map(detail => `• **/${detail.name}** — ${detail.description}`)
|
||||
.join('\n');
|
||||
|
||||
// Send the help message
|
||||
await interaction.reply(`Here are all the available commands:\n\n${helpMessage}`);
|
||||
const embed = new EmbedBuilder()
|
||||
.setColor(0x4b7bec)
|
||||
.setTitle('Available Commands')
|
||||
.setDescription(helpMessage)
|
||||
.setFooter({ text: `${commandDetails.length} commands loaded.` });
|
||||
|
||||
await interaction.reply({ embeds: [embed], ephemeral: true });
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user