From 9229eedd29eda9cf68f3cbb9f19434fe2471ffc3 Mon Sep 17 00:00:00 2001 From: Navy Date: Sun, 26 Jul 2020 23:10:46 +0300 Subject: [PATCH] show usage stuff, help command partial rewrite --- .../commands/information/Commands.js | 4 +-- .../components/commands/information/Help.js | 35 +++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/structure/client/components/commands/information/Commands.js b/structure/client/components/commands/information/Commands.js index 78c2f18..f602ba2 100644 --- a/structure/client/components/commands/information/Commands.js +++ b/structure/client/components/commands/information/Commands.js @@ -34,10 +34,10 @@ class CommandsCommand extends Command { params = params.join(' '); const [ mod ] = this.client.resolver.components(params, 'module', false); - if(!mod) { + if (!mod) { const [ command ] = this.client.resolver.components(params, 'command', false); if (!command) return message.format('C_COMMAND_INVALID'); - return message._showUsage(command); + return message.embed(command.usageEmbed(message, true)); } //list module's commands diff --git a/structure/client/components/commands/information/Help.js b/structure/client/components/commands/information/Help.js index 19f4c12..defedf3 100644 --- a/structure/client/components/commands/information/Help.js +++ b/structure/client/components/commands/information/Help.js @@ -22,24 +22,31 @@ class HelpCommand extends Command { const [ key ] = params; 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); if (!result) return message.embed({ description: message.format('C_HELP_404', { component: key }) }); - //let index = `${result.type.slice(0, 1).toUpperCase()}_${result.name.toUpperCase()}_HELP`; - return message.embed({ - description: message.format('C_HELP_TEMPLATE', { - desc: message.format(result.description), - component: result.name.toUpperCase(), - text: result.examples.map(ex => `\`{prefix}${result.type === 'command' ? result.name.toLowerCase() : `settings ${result.name.toLowerCase()}`} ${ex}\``).join('\n') - }), - fields: [ - { - name: 'Aliases', - value: result.aliases.map(al => al.toLowerCase()).join(', ') - } - ] - }); + if (result instanceof Array) { + + } else return message.embed(result.usageEmbed(message, true)); + + // //let index = `${result.type.slice(0, 1).toUpperCase()}_${result.name.toUpperCase()}_HELP`; + // const em = { + // description: message.format('C_HELP_TEMPLATE', { + // desc: message.format(result.description), + // component: result.name.toUpperCase(), + // text: result.examples.map((ex) => `\`{prefix}${result.type === 'command' ? result.name.toLowerCase() : `settings ${result.name.toLowerCase()}`} ${ex}\``).join('\n') + // }) + // }; + // if (result.aliases.length) em.fields = [ + // { + // name: 'Aliases', + // value: result.aliases.map((al) => al.toLowerCase()).join(', ') + // } + // ]; + + // return message.embed(em); }