diff --git a/docs/configuration.md b/docs/configuration.md index e53b193b1..810424e8f 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -244,6 +244,10 @@ Alias for [`serverGreetings`](#serverGreetings) **Default:** `off` If enabled, the bot attempts to ignore common "accidental" messages that would start a new thread, such as "ok", "thanks", etc. +#### ignoreOffensiveThreads +**Default:** `off` +If enabled, the bot attempts to ignore common "offensive" messages that would start a new thread, such as "fuck", "idiot", etc. + #### inboxServerPermission **Default:** `manageMessages` **Accepts multiple values.** Permission name, user id, or role id required to use bot commands on the inbox server. diff --git a/src/data/cfg.jsdoc.js b/src/data/cfg.jsdoc.js index bed89b5aa..ffe25a0e9 100644 --- a/src/data/cfg.jsdoc.js +++ b/src/data/cfg.jsdoc.js @@ -26,6 +26,7 @@ * @property {boolean} [useNicknames=false] * @property {boolean} [anonymizeChannelName=false] * @property {boolean} [ignoreAccidentalThreads=false] + * @property {boolean} [ignoreOffensiveThreads=false] * @property {boolean} [threadTimestamps=false] * @property {boolean} [allowMove=false] * @property {boolean} [syncPermissionsOnMove=true] diff --git a/src/data/constants.js b/src/data/constants.js index 886313ffa..5ce4fc63d 100644 --- a/src/data/constants.js +++ b/src/data/constants.js @@ -74,4 +74,37 @@ module.exports = { "okey np", "cheers" ], + + OFFENSIVE_THREAD_MESSAGES: [ + "idiot", + "moron", + "stupid", + "dumb", + "fool", + "jerk", + "loser", + "imbecile", + "asshole", + "bastard", + "bitch", + "douchebag", + "scumbag", + "prick", + "cretin", + "twit", + "twat", + "git", + "wanker", + "slut", + "whore", + "dickhead", + "fuckface", + "shithead", + "cocksucker", + "asshat", + "dipshit", + "nutcase", + "bonehead", + "jackass" + ], }; diff --git a/src/main.js b/src/main.js index bce3385bc..db538e987 100644 --- a/src/main.js +++ b/src/main.js @@ -16,6 +16,7 @@ const threads = require("./data/threads"); const updates = require("./data/updates"); const { ACCIDENTAL_THREAD_MESSAGES } = require("./data/constants"); +const { OFFENSIVE_THREAD_MESSAGES } = require("./data/constants"); const {getOrFetchChannel} = require("./utils"); module.exports = { @@ -181,6 +182,8 @@ function initBaseMessageHandlers() { // Ignore messages that shouldn't usually open new threads, such as "ok", "thanks", etc. if (config.ignoreAccidentalThreads && msg.content && ACCIDENTAL_THREAD_MESSAGES.includes(msg.content.trim().toLowerCase())) return; + if (config.ignoreOffensiveThreads && msg.content && OFFENSIVE_THREAD_MESSAGES.includes(msg.content.trim().toLowerCase())) return; + thread = await threads.createNewThreadForUser(msg.author, { source: "dm", message: msg,