Refactor entire help command, unfinished.

There are still a few thing's that need to be worked on, such as showing a category. This will rely on getting the parent folder of the command since I want to start categorizing everything like I should be to help make things easier to find.
This commit is contained in:
IDeletedSystem64 2022-07-26 20:44:00 -05:00
parent e1056c4d20
commit d527cab9f5
1 changed files with 26 additions and 16 deletions

View File

@ -2,35 +2,45 @@ module.exports = {
name: require('path').parse(__filename).name,
description: 'Get help on anything from commands, to what the bot does! just not your homework..',
options: [],
async parseMessage (client, config, message) {
await message.channel.send(this.handle(client, config, message.author));
options: [{
name: '<Command>',
description: 'View Information about this command',
required: false
}],
async parseMessage (client, config, message, args) {
await message.channel.send(this.handle(client, config, message.author, args));
},
async parseInteraction (client, config, interaction) {
await interaction.reply(this.handle(client, config, interaction.user));
},
handle (_, config, user) {
handle (client, config, user, args) {
if (!args[0]) {
return client.generateErrorMessage('Note to self: Design default help embed.', user.displayAvatarURL());
}
const cmdName = args[0].toLowerCase();
const cmd = client.commands.get(cmdName);
if (!cmd) {
return client.generateErrorMessage(`${cmdName} is not a valid command! Run ${config.prefix}help for a command list.`);
}
return {
embeds: [{
title: 'HELP! SEYMOUR! THE BOT IS ON FIRE!',
description: 'Get help on anything from commands, to what the bot does! just not your homework..',
color: 9442302,
title: ':question: Command Help',
description: `Everything you've ever wanted to know about ${cmdName}!`,
footer: {
icon_url: user.displayAvatarURL(),
text: `${config.footerTxt} | No mother it's just the northern lights`
text: config.footerTxt
},
fields: [
{
name: 'Command List',
value: '[Click here!](https://github.com/IDeletedSystem64/anitrox/blob/dev/commands.md)'
},
{
name: '...Or is the bot actually on fire?',
value: 'Join the [support server!](https://discord.gg/grebRGsBZ3)'
}
{ 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: 'Option Legend', value: '[Option] REQUIRED\n<Option> OPTIONAL' }
]
}]
};