DZ-Musicbot/commands/help.js

46 lines
1.6 KiB
JavaScript
Raw Normal View History

2024-08-17 15:20:51 -04:00
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'help',
2024-08-17 15:24:09 -04:00
description: 'List all commands or get details about a specific command',
2024-08-17 20:13:09 -04:00
aliases: ['h'],
2024-08-17 15:20:51 -04:00
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] });
},
};