mirror of
https://github.com/reality/dbot.git
synced 2024-12-25 20:22:39 +01:00
kills are deferred until user joins a non-exempt channel
This commit is contained in:
parent
f3dcc0e693
commit
e11abe5af4
@ -6,5 +6,6 @@
|
|||||||
"________ ______"
|
"________ ______"
|
||||||
],
|
],
|
||||||
"cliconn_channel": "#dnsbl",
|
"cliconn_channel": "#dnsbl",
|
||||||
"cliconn_patterns": []
|
"cliconn_patterns": [],
|
||||||
|
"exempt_channels": []
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,10 @@ var kill_namespam = function(dbot) {
|
|||||||
dbot.modules.admin.internalAPI.saveConfig();
|
dbot.modules.admin.internalAPI.saveConfig();
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
|
this.matchedKill = {};
|
||||||
|
|
||||||
this.listener = function(event) {
|
this.listener = function(event) {
|
||||||
|
if(event.action == 'PRIVMSG') {
|
||||||
// Here we listen for atropos
|
// Here we listen for atropos
|
||||||
if(event.channel == this.config.cliconn_channel) {
|
if(event.channel == this.config.cliconn_channel) {
|
||||||
if(event.message.match('▶')) {
|
if(event.message.match('▶')) {
|
||||||
@ -27,18 +30,15 @@ var kill_namespam = function(dbot) {
|
|||||||
'pattern': matchedPattern
|
'pattern': matchedPattern
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
var ip = event.message.split(' ')[1]
|
if(!this.matchedKill[host]) {
|
||||||
|
// Defer killing this connection until after they join a non-exempted channel
|
||||||
// Alternatively you can just do dbot.api.kick.kill(event.server, event.user, message);
|
this.matchedKill[host] = {
|
||||||
dbot.say(event.server, 'operserv', 'akill add *@'+ ip +' !P Naughty Nelly Auto-kill v6.2. Matched pattern: /'+ matchedPattern +'/');
|
ip: event.message.split(' ')[1],
|
||||||
|
server: event.server,
|
||||||
var msg = dbot.t('clikill_act', {
|
matchedPattern: matchedPattern,
|
||||||
'ip': ip,
|
rUser: event.rUser
|
||||||
'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);
|
}, true);
|
||||||
}
|
}
|
||||||
@ -86,8 +86,31 @@ var kill_namespam = function(dbot) {
|
|||||||
|
|
||||||
dbot.api.report.notify('spam', event.server, event.user, event.channel, message, event.host, event.user);
|
dbot.api.report.notify('spam', event.server, event.user, event.channel, message, event.host, event.user);
|
||||||
}
|
}
|
||||||
|
} else if (event.action == 'JOIN') {
|
||||||
|
|
||||||
|
if(this.matchedKill[event.host]) {
|
||||||
|
if(this.config.exempt_channels.indexOf(event.channel) == -1) {
|
||||||
|
var kill = this.matchedKill[event.host];
|
||||||
|
delete this.matchedKill[event.host];
|
||||||
|
|
||||||
|
// Alternatively you can just do dbot.api.kick.kill(event.server, event.user, message);
|
||||||
|
dbot.say(event.server, 'operserv', 'akill add *@'+ kill.ip +' !P Naughty Nelly Auto-kill v6.2. Matched pattern: /'+ kill.matchedPattern +'/');
|
||||||
|
|
||||||
|
var msg = dbot.t('clikill_act', {
|
||||||
|
'ip': kill.ip,
|
||||||
|
'pattern': kill.matchedPattern
|
||||||
|
});
|
||||||
|
dbot.api.report.notify('autokill', kill.server, kill.rUser,
|
||||||
|
dbot.config.servers[kill.server].admin_channel, msg, kill.ip, kill.ip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (event.action == 'QUIT') {
|
||||||
|
if(this.matchedKill[event.host]) {
|
||||||
|
delete this.matchedKill[event.host];
|
||||||
|
}
|
||||||
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
this.on = 'PRIVMSG';
|
this.on = ['PRIVMSG', 'JOIN', 'QUIT'];
|
||||||
|
|
||||||
this.commands = {
|
this.commands = {
|
||||||
'~add_spamkill': function(event) {
|
'~add_spamkill': function(event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user