From db79b4b026b16a4f792a0fdfe2e6bf7e1052624f Mon Sep 17 00:00:00 2001 From: 1computer1 Date: Wed, 13 Mar 2019 01:04:18 -0400 Subject: [PATCH] Add languages configuration --- config.example.json | 10 ++++++++-- src/struct/LanguageHandler.js | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/config.example.json b/config.example.json index 24ef5a6..fb13dea 100644 --- a/config.example.json +++ b/config.example.json @@ -1,4 +1,10 @@ { - "owner": "123", - "token": "123" + "owner": "Discord ID of the bot owner(s)", + "token": "Bot token", + "languages": [ + "Language whitelist, e.g.", + "haskell", + "python", + "Leave empty to enable all languages" + ] } diff --git a/src/struct/LanguageHandler.js b/src/struct/LanguageHandler.js index 2c7282e..f362927 100644 --- a/src/struct/LanguageHandler.js +++ b/src/struct/LanguageHandler.js @@ -11,7 +11,8 @@ class LanguageHandler extends AkairoHandler { classToHandle = Language, extensions = ['.js', '.ts'], automateCategories, - loadFilter + loadFilter = filepath => + !this.client.config.languages.length || this.client.config.languages.includes(path.parse(filepath).name) }) { super(client, { directory,