From 9faffa0d11b44f19466ce7bdbb049ac25b28f8ba Mon Sep 17 00:00:00 2001 From: reality Date: Thu, 1 Mar 2018 13:41:59 +0000 Subject: [PATCH] add cliconn autorek --- modules/kill_namespam/config.json | 4 ++- modules/kill_namespam/kill_namespam.js | 41 ++++++++++++++++++++++++++ modules/kill_namespam/strings.json | 3 ++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/modules/kill_namespam/config.json b/modules/kill_namespam/config.json index dc9d0f9..3bafe0f 100644 --- a/modules/kill_namespam/config.json +++ b/modules/kill_namespam/config.json @@ -4,5 +4,7 @@ "exempt": [], "advert_content": [ "________ ______" - ] + ], + "cliconn_channel": "#dnsbl", + "cliconn_patterns": [] } diff --git a/modules/kill_namespam/kill_namespam.js b/modules/kill_namespam/kill_namespam.js index 5eddb17..7be7fb9 100644 --- a/modules/kill_namespam/kill_namespam.js +++ b/modules/kill_namespam/kill_namespam.js @@ -8,6 +8,28 @@ var _ = require('underscore')._; var kill_namespam = function(dbot) { this.listener = function(event) { + // Here we listen for atropos + if(event.channel == this.config.cliconn_channel) { + 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(' ') + + // 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'); + + var msg = dbot.t('clikill_act', { + 'ip': ip, + 'pattern': matchedPattern + }); + event.reply(msg); + dbot.api.report.notify('autokill', event.server, event.user, + dbot.config.servers[event.server].admin_channel, msg, ip, ip); + } + } + } + + // This is the namespam if(event.channel == event.user) return; // return if pm if(_.includes(this.config.exempt, event.user)) return; @@ -60,6 +82,25 @@ var kill_namespam = function(dbot) { '~del_spamkill': function(event) { this.config.advert_content = _.without(this.config.advert_content, event.params.slice(1).join(' ')); event.reply('Users will no longer be killed for this utterance.'); + }, + + '~add_clikill': function(event) { + var pattern = event.params.slice(1).join(' '); + this.config.cliconn_patterns.push(pattern); + event.reply('Client connection notices matching pattern /'+ pattern +'/ shall henceforth get rekt.'); + }, + + '~del_clikill': function(event) { + var pattern = event.params.slice(1).join(' '); + this.config.cliconn_patterns = _.without(this.config.cliconn_patterns, pattern); + event.reply('Client connection notices matching pattern /'+ pattern +'/ will no longer get rekt.'); + }, + + '~list_clikill': function(event) { + event.reply('Currently active "cliconn" kills (tip: when using this, don\'t include your own slashes aroudn the patterns!): '); + _.each(this.config.cliconn_patterns, function(pattern, i) { + event.reply('['+i+'] /' + pattern + '/'); + }); } }; diff --git a/modules/kill_namespam/strings.json b/modules/kill_namespam/strings.json index 99b3624..8717fbf 100644 --- a/modules/kill_namespam/strings.json +++ b/modules/kill_namespam/strings.json @@ -4,5 +4,8 @@ }, "spamcont_act": { "en": "{user} triggered advertising anti-spam (content). Action: {action}" + }, + "clikill_act": { + "en": "Added K-Line for {ip}, due to matching pattern: /{pattern}/" } }