-
Notifications
You must be signed in to change notification settings - Fork 0
/
badwords.js
59 lines (49 loc) · 1.57 KB
/
badwords.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use strict'
/*
Bad word checker
Checks if the user has a cooldown on a command
TODO: Add enable/disable check. Needs a mild re-write
*/
module.exports = class {
constructor(client, db) {
this.client = client;
this.db = db;
}
onChatHook(msg) {
var settings = module.exports.config;
var client = this.client;
var phrase = msg.content.toLowerCase().replace(/[^a-zA-Z\d\s:]/gi, '');
var words = settings.words;
var ignore = settings.channels.ignore;
var author = msg.author;
if(ignore.includes(msg.channel.id)) { return; }
for (var i = 0; i < words.length; i++) {
var word = words[i];
var find_word = new RegExp(`${word}`,'gi');
find_word = phrase.match(find_word);
if(find_word == word) {
msg.delete();
author.send(settings.messages.dm.replace(`%word%`, `${word}`));
return;
}
}
}
}
/*
Module settings
*/
module.exports.config = {
info: {
ignore: true
},
channels: {
log: '586704853485486091',
ignore: ['586704853485486091']
},
words: ['boogers','nigger','niggers','faggot','faggots','fag','fags','nègre','negro','nègro','negre','pédé','neger','chink','chinks','chinky','cholos','kyke'],
primary_color: 16752640,
messages: {
chat: '%player% your message was removed because you used inappropriate language',
dm: 'Your message was automatically removed for using the word __%word%__.'
}
}