forked from GitHub/dbot
clikill spares SASL-authenticated users from match kills
This commit is contained in:
parent
bbfc4c18a6
commit
d544dcf017
@ -18,18 +18,29 @@ var kill_namespam = function(dbot) {
|
||||
if(event.message.match('▶')) {
|
||||
var matchedPattern = _.find(this.config.cliconn_patterns, function(p) { return event.message.match(p); })
|
||||
if(matchedPattern) {
|
||||
var ip = event.message.split(' ')[1]
|
||||
var nick = event.message.split(' ')[2];
|
||||
dbot.api.nickserv.getUserHost(event.server, nick, function(host) {
|
||||
var userIsAuthenticated = host && host.startsWith('tripsit/');
|
||||
if (userIsAuthenticated) {
|
||||
event.reply(dbot.t('clikill_spared', {
|
||||
'user': nick,
|
||||
'pattern': matchedPattern
|
||||
}));
|
||||
} else {
|
||||
var ip = event.message.split(' ')[1]
|
||||
|
||||
// Alternatively you can just do dbot.api.kick.kill(event.server, event.user, message);
|
||||
dbot.say(event.server, 'operserv', 'akill add *@'+ ip +' !P Naughty Nelly Auto-kill v6.2. Matched pattern: /'+ matchedPattern +'/');
|
||||
// Alternatively you can just do dbot.api.kick.kill(event.server, event.user, message);
|
||||
dbot.say(event.server, 'operserv', 'akill add *@'+ ip +' !P Naughty Nelly Auto-kill v6.2. Matched pattern: /'+ matchedPattern +'/');
|
||||
|
||||
var msg = dbot.t('clikill_act', {
|
||||
'ip': ip,
|
||||
'pattern': matchedPattern
|
||||
});
|
||||
event.reply(msg);
|
||||
dbot.api.report.notify('autokill', event.server, event.rUser,
|
||||
dbot.config.servers[event.server].admin_channel, msg, ip, ip);
|
||||
var msg = dbot.t('clikill_act', {
|
||||
'ip': ip,
|
||||
'pattern': matchedPattern
|
||||
});
|
||||
event.reply(msg);
|
||||
dbot.api.report.notify('autokill', event.server, event.rUser,
|
||||
dbot.config.servers[event.server].admin_channel, msg, ip, ip);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,5 +7,8 @@
|
||||
},
|
||||
"clikill_act": {
|
||||
"en": "Added K-Line for {ip}, due to matching pattern: /{pattern}/"
|
||||
},
|
||||
"clikill_spared": {
|
||||
"en": "{user} spared from clikill matched pattern: /{pattern}/"
|
||||
}
|
||||
}
|
||||
|
@ -26,18 +26,22 @@ var nickserv = function(dbot) {
|
||||
}.bind(this), 6000);
|
||||
},
|
||||
|
||||
'getUserHost': function(server, nick, callback) {
|
||||
'getUserHost': function(server, nick, callback, skipFallback) {
|
||||
if(!_.has(this.userStack, server)) this.userStack[server] = {};
|
||||
this.userStack[server][nick] = callback;
|
||||
dbot.instance.connections[server].send('USERHOST ' + nick);
|
||||
setTimeout(function() {
|
||||
if(_.has(this.userStack[server], nick)) {
|
||||
dbot.instance.connections[server].send('WHOWAS ' + nick + ' 1');
|
||||
setTimeout(function() {
|
||||
if(_.has(this.userStack[server], nick)) {
|
||||
callback(false);
|
||||
}
|
||||
}.bind(this), 2000);
|
||||
if (skipFallback) {
|
||||
callback(false);
|
||||
} else {
|
||||
dbot.instance.connections[server].send('WHOWAS ' + nick + ' 1');
|
||||
setTimeout(function() {
|
||||
if(_.has(this.userStack[server], nick)) {
|
||||
callback(false);
|
||||
}
|
||||
}.bind(this), 2000);
|
||||
}
|
||||
}
|
||||
}.bind(this), 4000);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user