From b0c10b1fdaf68a465f673879113edc3a495c8c59 Mon Sep 17 00:00:00 2001 From: Dragory Date: Tue, 31 Jul 2018 19:00:17 +0300 Subject: [PATCH] Only load plugins that are defined in config --- src/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/index.ts b/src/index.ts index 21474262..c78770ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -43,6 +43,16 @@ knex.migrate.latest().then(() => { }, globalPlugins: { bot_control: BotControlPlugin + }, + + options: { + getEnabledPlugins(guildId, guildConfig): string[] { + const plugins = guildConfig.plugins || {}; + const keys: string[] = Array.from(this.plugins.keys()); + return keys.filter(pluginName => { + return plugins[pluginName] && plugins[pluginName].enabled !== false; + }); + } } });