@@ -2,6 +2,7 @@ import wordFilter from '../../Utils/functions/wordFilter';
22import antiSpam from './antiSpam' ;
33import { Message } from 'discord.js' ;
44import { Db } from 'mongodb' ;
5+ import { slurs } from '../../Utils/JSON/badwords.json' ;
56
67export = {
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 }
0 commit comments