do not fail broken regex

This commit is contained in:
reality 2018-04-20 21:01:11 +00:00
parent ae989d60ae
commit 554a9e995b

View File

@ -16,7 +16,8 @@ var kill_namespam = function(dbot) {
// 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('▶')) {
var matchedPattern = _.find(this.config.cliconn_patterns, function(p) { return event.message.match(p); }) var matchedPattern = _.find(this.config.cliconn_patterns,
function(p) { try { return event.message.match(p); } catch(e) {}; }); // ok.jpg
if(matchedPattern) { if(matchedPattern) {
var ip = event.message.split(' ')[1] var ip = event.message.split(' ')[1]