From 8ad54271df3c9c4f6eb55e8fb9fe22254e91d7b5 Mon Sep 17 00:00:00 2001 From: Navy Date: Thu, 6 Aug 2020 01:13:27 +0300 Subject: [PATCH] finished the help command --- .../components/commands/information/Help.js | 53 +++++++++++++++---- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/structure/client/components/commands/information/Help.js b/structure/client/components/commands/information/Help.js index 01ca1a1..76dcfd6 100644 --- a/structure/client/components/commands/information/Help.js +++ b/structure/client/components/commands/information/Help.js @@ -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; \ No newline at end of file