From 4bfd247be3169de2927e4e3ba1940e649685c1a2 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sun, 9 Jun 2019 19:31:16 +0300 Subject: [PATCH] Add support for command aliases --- README.md | 1 + src/config.js | 2 ++ src/main.js | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 19782b8..41b9f8f 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ These go in `config.json`. See also `config.example.json`. |categoryAutomation.newThread|None|Same as `newThreadCategoryId`. Specifies a category to open all new threads in. Also functions as a fallback for `categoryAutomation.newThreadFromGuild`.| |categoryAutomation.newThreadFromGuild|None|Allows you to open threads in specific categories based on which guild the user is messaging the bot from. The value is an object with guild ids as the keys and category ids as the values.| |closeMessage|None|The bot's message to the user when the thread is closed| +|commandAliases|None|Custom aliases for commands. Value is an object with the alias as the key and the real command as the value.| |enableGreeting|false|Set to true to send a welcome message to new main guild members. Requires `mainGuildId` to be set.| |greetingAttachment|None|Path to an image or other attachment to send along with the greeting| |greetingMessage|None|Text content of the welcome message| diff --git a/src/config.js b/src/config.js index b097599..f0edffd 100644 --- a/src/config.js +++ b/src/config.js @@ -94,6 +94,8 @@ const defaultConfig = { "updateNotifications": true, "plugins": [], + "commandAliases": {}, + "port": 8890, "url": null, diff --git a/src/main.js b/src/main.js index e552d13..efdd0ca 100644 --- a/src/main.js +++ b/src/main.js @@ -213,6 +213,13 @@ module.exports = { updates.startVersionRefreshLoop(); } + // Register command aliases + if (config.commandAliases) { + for (const alias in config.commandAliases) { + bot.registerCommandAlias(alias, config.commandAliases[alias]); + } + } + // Connect to Discord console.log('Connecting to Discord...'); await bot.connect();