From a48098bb8ced11dd538a8d41d0ec6cc9f5b53b9f Mon Sep 17 00:00:00 2001 From: tipakA <31581159+tipakA@users.noreply.github.com> Date: Sun, 2 Jun 2019 06:33:45 +0200 Subject: [PATCH] Move list of languages to separate command (#5) --- src/commands/help.js | 3 +-- src/commands/languages.js | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 src/commands/languages.js diff --git a/src/commands/help.js b/src/commands/help.js index 56d9792..abdec67 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -14,8 +14,7 @@ class HelpCommand extends Command { 'Put a `>` before a code block or inline codeblock that starts with a language code to execute it.', 'You can add options, separated by semicolons, after the `>`.', '', - '**Enabled Languages (Name: Language Codes):**', - ...this.client.languageHandler.modules.map(lang => `${lang.name}: \`${lang.aliases.join('`, `')}\``), + 'For list of enabled languages, use `languages` command.', '', 'See the readme for usage examples, supported languages, and options: ' ]); diff --git a/src/commands/languages.js b/src/commands/languages.js new file mode 100644 index 0000000..e4c36f3 --- /dev/null +++ b/src/commands/languages.js @@ -0,0 +1,21 @@ +const { Command } = require('discord-akairo'); + +class LanguagesCommand extends Command { + constructor() { + super('languages', { + aliases: ['languages', 'language'], + clientPermissions: ['SEND_MESSAGES'] + }); + } + + exec(message) { + return message.util.send([ + '**List of enabled languages (Name: Language Codes)**:', + ...this.client.languageHandler.modules.map(lang => `${lang.name}: \`${lang.aliases.join('`, `')}\``), + '', + 'See the readme for usage examples, supported langagues, and options: ' + ]); + } +} + +module.exports = LanguagesCommand;