forked from GitHub/dbot
clikill spares SASL-authenticated users from match kills
This commit is contained in:
parent
bbfc4c18a6
commit
d544dcf017
@ -18,6 +18,15 @@ 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 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);
|
||||
@ -31,6 +40,8 @@ var kill_namespam = function(dbot) {
|
||||
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,12 +26,15 @@ 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)) {
|
||||
if (skipFallback) {
|
||||
callback(false);
|
||||
} else {
|
||||
dbot.instance.connections[server].send('WHOWAS ' + nick + ' 1');
|
||||
setTimeout(function() {
|
||||
if(_.has(this.userStack[server], nick)) {
|
||||
@ -39,6 +42,7 @@ var nickserv = function(dbot) {
|
||||
}
|
||||
}.bind(this), 2000);
|
||||
}
|
||||
}
|
||||
}.bind(this), 4000);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user