finished the help command
This commit is contained in:
parent
11a6c7e255
commit
8ad54271df
@ -20,6 +20,8 @@ class HelpCommand extends Command {
|
||||
});
|
||||
|
||||
const [ key ] = params;
|
||||
if (key.toLowerCase() === 'modhelp') return this._modhelp(message);
|
||||
|
||||
let [ result ] = this.client.resolver.components(key, 'command');
|
||||
if (!result) [ result ] = this.client.resolver.components(key, 'setting');
|
||||
if (!result) result = this.client.resolver.componentsByTag(key, 'any', false);
|
||||
@ -35,18 +37,22 @@ class HelpCommand extends Command {
|
||||
const embed = {
|
||||
description: message.format('C_HELP_TAGS', { keyword: key }),
|
||||
fields: [
|
||||
{
|
||||
name: 'Commands',
|
||||
value: commands.length ? commands.map((c) => c.name).join('\n') : 'N/A',
|
||||
inline: true
|
||||
},
|
||||
{
|
||||
name: 'Settings',
|
||||
value: settings.length ? settings.map((s) => s.display).join('\n') : 'N/A',
|
||||
inline: true
|
||||
}
|
||||
|
||||
]
|
||||
};
|
||||
|
||||
if (commands.length) embed.fields.push({
|
||||
name: 'Commands',
|
||||
value: commands.map((c) => c.name).join('\n'),
|
||||
inline: true
|
||||
});
|
||||
if (settings.length) embed.fields.push({
|
||||
name: 'Settings',
|
||||
value: settings.map((s) => s.display).join('\n'),
|
||||
inline: true
|
||||
});
|
||||
|
||||
if (!embed.fields.length) embed.description += '\n\n' + message.format('NO_RESULT');
|
||||
|
||||
return message.embed(embed);
|
||||
|
||||
@ -73,6 +79,33 @@ class HelpCommand extends Command {
|
||||
|
||||
}
|
||||
|
||||
_modhelp(message) {
|
||||
|
||||
return message.embed({
|
||||
title: message.format('MODHELP_TITLE'),
|
||||
description: message.format('MODHELP_DESC'),
|
||||
fields: [
|
||||
{
|
||||
name: message.format('MODHELP_FIELD_1_NAME'),
|
||||
value: message.format('MODHELP_FIELD_1_VALUE')
|
||||
},
|
||||
{
|
||||
name: message.format('MODHELP_FIELD_2_NAME'),
|
||||
value: message.format('MODHELP_FIELD_2_VALUE')
|
||||
},
|
||||
{
|
||||
name: message.format('MODHELP_FIELD_3_NAME'),
|
||||
value: message.format('MODHELP_FIELD_3_VALUE')
|
||||
},
|
||||
{
|
||||
name: message.format('MODHELP_FIELD_4_NAME'),
|
||||
value: message.format('MODHELP_FIELD_4_VALUE')
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = HelpCommand;
|
Loading…
Reference in New Issue
Block a user