Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/data/cfg.jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
33 changes: 33 additions & 0 deletions src/data/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
};
3 changes: 3 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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,
Expand Down