From 1e04bfec0dc0f872150a278ed21dd4a6ff40fe9a Mon Sep 17 00:00:00 2001 From: Navy Date: Tue, 5 May 2020 16:33:14 +0300 Subject: [PATCH] Stuff --- .../en_us/commands/en_us_information.lang | 2 +- .../components/commands/information/Help.js | 44 +++++++++---------- structure/extensions/Message.js | 4 +- structure/interfaces/Setting.js | 3 +- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/language/languages/en_us/commands/en_us_information.lang b/language/languages/en_us/commands/en_us_information.lang index 0e68397..2d63977 100644 --- a/language/languages/en_us/commands/en_us_information.lang +++ b/language/languages/en_us/commands/en_us_information.lang @@ -1,4 +1,4 @@ -[C_HELP] +[C_HELP_USAGE] **__HELP MENU__** For a list of all available commands, use `{prefix}commands [ group ]`. diff --git a/structure/client/components/commands/information/Help.js b/structure/client/components/commands/information/Help.js index 1a1c70f..24887a7 100644 --- a/structure/client/components/commands/information/Help.js +++ b/structure/client/components/commands/information/Help.js @@ -7,7 +7,8 @@ class HelpCommand extends Command { super(client, { name: 'help', module: 'information', - description: 'Get help!' + description: 'Get help!', + showUsage: true }); this.client = client; @@ -16,32 +17,29 @@ class HelpCommand extends Command { } async execute(message, { params }) { - - if (params.length === 0) - await message.embed({ - //title: message.format('C_HELP_TITLE'), - description: message.format('C_HELP') - }); - else { - const key = params[0]; - let [result] = this.client.resolver.components(key, 'command'); - if (!result) [result] = this.client.resolver.components(key, 'setting'); - if (!result) - return await message.embed({ - description: message.format('C_HELP_404', { component: key }) - }); - - let index = `${result.type.slice(0, 1).toUpperCase()}_${result.name.toUpperCase()}_HELP`; + const [ key ] = params; + let [ result ] = this.client.resolver.components(key, 'command'); + if (!result) [ result ] = this.client.resolver.components(key, 'setting'); + if (!result) return await message.embed({ - description: message.format('C_HELP_TEMPLATE', { - desc: result.description, - component: result.name.toUpperCase(), - text: message.format(index) - }) + description: message.format('C_HELP_404', { component: key }) }); - } + //let index = `${result.type.slice(0, 1).toUpperCase()}_${result.name.toUpperCase()}_HELP`; + return await message.embed({ + description: message.format('C_HELP_TEMPLATE', { + desc: message.format(result.description), + component: result.name.toUpperCase(), + text: message.format(result.example) + })//, + // fields: [ + // { + // name: '', + // value: message.format(result.examples) + // } + // ] + }); } diff --git a/structure/extensions/Message.js b/structure/extensions/Message.js index ced3860..c4e2ae3 100644 --- a/structure/extensions/Message.js +++ b/structure/extensions/Message.js @@ -49,7 +49,7 @@ const Message = Structures.extend('Message', (Message) => { async resolve() { - if(this.command.showUsage && !this.parameters) { + if (this.command.showUsage && !this.parameters.length) { return this._showUsage(); } @@ -100,7 +100,7 @@ const Message = Structures.extend('Message', (Message) => { return super.edit(str); } - _showUsage() { + async _showUsage() { //TODO: format this return await this.embed({ title: `**${this.command.name.toUpperCase()} USAGE**`, diff --git a/structure/interfaces/Setting.js b/structure/interfaces/Setting.js index 32cff6e..304e890 100644 --- a/structure/interfaces/Setting.js +++ b/structure/interfaces/Setting.js @@ -17,7 +17,8 @@ class Setting extends Component { this.module = opts.module; this.restricted = Boolean(opts.restricted); - this.description = opts.description || "A basic setting."; + this.description = `S_${opts.name}_DESCRIPTION`; + this.examples = `S_${opts.name}_EXAMPLES`; this.archiveable = Boolean(opts.archiveable); this.index = opts.index || opts.name;