This repository has been archived on 2024-01-30. You can view files and clone it, but cannot push or open issues or pull requests.
anitrox/commands/help.js

62 lines
2.3 KiB
JavaScript
Raw Normal View History

const { Constants } = require('discord.js');
2021-01-19 14:02:09 -06:00
module.exports = {
name: require('path').parse(__filename).name,
2022-03-18 21:27:09 -05:00
description: 'Get help on anything from commands, to what the bot does! just not your homework..',
options: [{
2022-08-02 23:53:44 -05:00
name: 'help',
description: 'The command you want information on',
required: false,
type: Constants.ApplicationCommandOptionTypes.STRING
}],
async parseInteraction (client, config, interaction) {
2022-08-02 23:53:44 -05:00
await interaction.reply(this.handle(client, config, interaction.user, interaction.options.getString('help')));
},
handle (client, config, user, command) {
if (!command) {
2022-08-02 23:53:44 -05:00
return {
embeds: [{
color: 9442302,
2022-08-02 23:53:44 -05:00
title: `:question: SEYMOUR! THE ${client.user.username} IS ON FIRE!`,
description: `Run ${config.prefix}help for more information on each command.`,
footer: {
icon_url: user.displayAvatarURL(),
text: config.footerTxt
},
fields: [
{ name: 'Commands', value: client.commands.map(command => command.name).join(', ') }
2022-08-02 23:53:44 -05:00
]
}]
};
}
2022-08-02 23:53:44 -05:00
const cmdName = command;
const cmd = client.commands.get(cmdName);
console.log(cmd.options.map);
if (!cmd) {
return client.generateErrorMessage(`${cmdName} is not a valid command. Run ${config.prefix}help for a command list!`);
}
return {
embeds: [{
color: 9442302,
title: ':question: Command Help',
description: `Everything you've ever wanted to know about ${cmdName}!`,
footer: {
icon_url: user.displayAvatarURL(),
text: config.footerTxt
2022-03-18 21:27:09 -05:00
},
fields: [
{ name: 'Command Name', value: `${cmdName}`, inline: true },
{ name: 'Command Description', value: cmd.description, inline: true },
{ name: 'Command Options', value: cmd.options.map(option => option.name).join('\n') || 'None', inline: true },
{ name: 'Command Option Description', value: cmd.options.map(option => option.description).join('\n') || 'None', inline: true }
// { name: 'Command Option Required?', value: cmd.options.map(option => option.required) ? 'Yes' : 'No' }
]
}]
};
}
};