From 61c75f20e059a214308d2bb11c5f3af0ab69cf9a Mon Sep 17 00:00:00 2001 From: Navy Date: Fri, 1 May 2020 17:12:54 +0300 Subject: [PATCH] help command --- .../components/commands/information/Help.js | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 structure/client/components/commands/information/Help.js diff --git a/structure/client/components/commands/information/Help.js b/structure/client/components/commands/information/Help.js new file mode 100644 index 0000000..1a1c70f --- /dev/null +++ b/structure/client/components/commands/information/Help.js @@ -0,0 +1,50 @@ +const { Command } = require('../../../../interfaces/'); + +class HelpCommand extends Command { + + constructor(client) { + + super(client, { + name: 'help', + module: 'information', + description: 'Get help!' + }); + + this.client = client; + + + } + + 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`; + return await message.embed({ + description: message.format('C_HELP_TEMPLATE', { + desc: result.description, + component: result.name.toUpperCase(), + text: message.format(index) + }) + }); + + } + + } + +} + +module.exports = HelpCommand; \ No newline at end of file