46 lines
1.6 KiB
JavaScript
46 lines
1.6 KiB
JavaScript
const { EmbedBuilder } = require('discord.js');
|
|
|
|
module.exports = {
|
|
name: 'help',
|
|
description: 'List all commands or get details about a specific command',
|
|
aliases: ['h'],
|
|
execute(message, args) {
|
|
const { commands } = message.client;
|
|
const commandsArray = Array.from(commands.values());
|
|
|
|
if (!args.length) {
|
|
const embed = new EmbedBuilder()
|
|
.setColor('#0099ff')
|
|
.setTitle('Help - List of Commands')
|
|
.setDescription('Here\'s a list of all my commands:')
|
|
.addFields(
|
|
commandsArray.map(command => ({
|
|
name: `\`${command.name}\``,
|
|
value: command.description || 'No description provided',
|
|
inline: true,
|
|
}))
|
|
)
|
|
.setFooter({ text: 'You can send `+help [command name]` to get info on a specific command!' });
|
|
|
|
return message.channel.send({ embeds: [embed] });
|
|
}
|
|
|
|
const name = args[0].toLowerCase();
|
|
const command = commands.get(name);
|
|
|
|
if (!command) {
|
|
return message.reply('That\'s not a valid command!');
|
|
}
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setColor('#0099ff')
|
|
.setTitle(`Help - \`${command.name}\``)
|
|
.addFields(
|
|
{ name: 'Name', value: command.name, inline: true },
|
|
{ name: 'Description', value: command.description || 'No description provided', inline: true }
|
|
);
|
|
|
|
message.channel.send({ embeds: [embed] });
|
|
},
|
|
};
|