forked from GitHub/dbot
also add check for distinctive spam content
This commit is contained in:
parent
510a02d08a
commit
56d12bd649
@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"action": "kill",
|
"action": "kill",
|
||||||
"sensitivity": 10,
|
"sensitivity": 10,
|
||||||
"exempt": []
|
"exempt": [],
|
||||||
|
"advert_content": [
|
||||||
|
"________ ______"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,29 @@ var kill_namespam = function(dbot) {
|
|||||||
this.listener = function(event) {
|
this.listener = function(event) {
|
||||||
if(event.channel == event.user) return; // return if pm
|
if(event.channel == event.user) return; // return if pm
|
||||||
if(_.includes(this.config.exempt, event.user)) return;
|
if(_.includes(this.config.exempt, event.user)) return;
|
||||||
|
|
||||||
|
var message;
|
||||||
|
|
||||||
|
// Check distinctive spam content match
|
||||||
|
if(_.any(this.config.advert_content, function(spam) { return event.message.match(spam); })) {
|
||||||
|
message = dbot.t('spamcont_act', {
|
||||||
|
'user': event.user,
|
||||||
|
'channel': event.channel,
|
||||||
|
'action': this.config.action
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Name highlight spam
|
||||||
if(_.filter(event.message.split(' '), function(word) { return _.has(event.channel.nicks, word); }).length > this.config.sensitivity) {
|
if(_.filter(event.message.split(' '), function(word) { return _.has(event.channel.nicks, word); }).length > this.config.sensitivity) {
|
||||||
var message = dbot.t('namespam_act', {
|
message = dbot.t('namespam_act', {
|
||||||
'user': event.user,
|
'user': event.user,
|
||||||
'channel': event.channel,
|
'channel': event.channel,
|
||||||
'action': this.config.action,
|
'action': this.config.action,
|
||||||
'sensitivity': this.config.sensitivity
|
'sensitivity': this.config.sensitivity
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if(naughty) {
|
||||||
switch(this.config.action) {
|
switch(this.config.action) {
|
||||||
case 'kickban':
|
case 'kickban':
|
||||||
dbot.api.kick.ban(event.server, event.host, event.channel);
|
dbot.api.kick.ban(event.server, event.host, event.channel);
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"namespam_act": {
|
"namespam_act": {
|
||||||
"en": "{user} triggered nickname hilight anti-spam (greater than {sensitivity}). Action: {action}."
|
"en": "{user} triggered nickname hilight anti-spam (greater than {sensitivity}). Action: {action}."
|
||||||
|
},
|
||||||
|
"spamcont_act": {
|
||||||
|
"en": "{user} triggered advertising anti-spam (content). Action: {action}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user