Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit 336fbe0

Browse files
committed
fix: Moved list of slurs from db to local JSON
1 parent 4866f73 commit 336fbe0

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/Scripts/message/checks.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import wordFilter from '../../Utils/functions/wordFilter';
22
import antiSpam from './antiSpam';
33
import { Message } from 'discord.js';
44
import { Db } from 'mongodb';
5+
import { slurs } from '../../Utils/JSON/badwords.json';
56

67
export = {
78
async execute(message: Message, database: Db | undefined) {
@@ -11,10 +12,6 @@ export = {
1112
const blacklistedUsers = database?.collection('blacklistedUsers');
1213
const userInBlacklist = await blacklistedUsers?.findOne({ userId: message.author.id });
1314

14-
// collection for blacklisted words
15-
const restrictedWords = database?.collection('restrictedWords');
16-
const wordList = await restrictedWords?.findOne({ name: 'blacklistedWords' });
17-
1815
if (userInBlacklist) {
1916
// if user is in blacklist and Notified is false, send them a message saying they are blacklisted
2017
if (!userInBlacklist.notified) {
@@ -28,11 +25,7 @@ export = {
2825
}
2926

3027
// check if message contains slurs
31-
if (
32-
message.content.toLowerCase().includes(wordList?.words[0]) ||
33-
message.content.toLowerCase().includes(wordList?.words[1]) ||
34-
message.content.toLowerCase().includes(wordList?.words[2])
35-
) {
28+
if (message.content.split(/\b/).some(word => slurs.includes(word.toLocaleLowerCase()))) {
3629
wordFilter.log(message.client, message.author, message.guild, message.content);
3730
return false;
3831
}

src/Utils/JSON/badwords.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
{
2+
"slurs": [
3+
"nigga",
4+
"nigg",
5+
"nigger",
6+
"n1gger",
7+
"n1gg3r"
8+
],
9+
210
"badwords": [
311
"4r5e",
412
"5h1t",

0 commit comments

Comments
 (0)