From 14f7d37c717c501975a481ef3d4420e177ea78e2 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 17 Jul 2022 13:18:34 +0200 Subject: [PATCH] allow loading spam detection module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Martin Löffler --- bot/src/bot/modules/raid_detection.ts | 9 +++++++++ bot/src/index.ts | 1 + 2 files changed, 10 insertions(+) create mode 100644 bot/src/bot/modules/raid_detection.ts diff --git a/bot/src/bot/modules/raid_detection.ts b/bot/src/bot/modules/raid_detection.ts new file mode 100644 index 0000000..195b288 --- /dev/null +++ b/bot/src/bot/modules/raid_detection.ts @@ -0,0 +1,9 @@ +import path from 'path'; +import { client } from '../..'; +import logger from '../logger'; + +if (process.env['AUTOMOD_LOAD_SPAM_DETECTION']) { + logger.info('Importing spam detection'); + import(path.join(process.cwd(), '..', 'private', 'automod-spam-detection', 'dist', 'index.js')) + .then(mod => mod.raidDetection(client as any, logger, client.db, process.env.REDIS_URL)); +} diff --git a/bot/src/index.ts b/bot/src/index.ts index 0e453a0..e4d44ca 100644 --- a/bot/src/index.ts +++ b/bot/src/index.ts @@ -68,4 +68,5 @@ logger.info(`\ import('./bot/modules/metrics'); import('./bot/modules/bot_status'); import('./bot/modules/fetch_all'); + import('./bot/modules/raid_detection'); })();