From 0ad2f46abdc1ef6ff230c6f0028122a29e25d0c2 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Fri, 9 Dec 2011 01:35:39 +0000 Subject: [PATCH 1/2] ban on thing --- run.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/run.js b/run.js index f83841b..a7093f0 100644 --- a/run.js +++ b/run.js @@ -104,14 +104,19 @@ DBot.prototype.reloadModules = function() { this.save(); } } else { - var q = data.message.valMatch(/^~([\d\w\s]*)/, 2); - if(q) { - q[1] = q[1].trim(); - key = this.cleanNick(q[1]) - if(this.db.quoteArrs.hasOwnProperty(key)) { - this.say(data.channel, q[1] + ': ' + this.db.quoteArrs[key].random()); - } else { - this.say(data.channel, 'Nobody loves ' + q[1]); + if(this.db.bans['*'].include(data.user)) { + this.say(data.channel, data.user + + ' is banned from using this command. Commence incineration.'); + } else { + var q = data.message.valMatch(/^~([\d\w\s]*)/, 2); + if(q) { + q[1] = q[1].trim(); + key = this.cleanNick(q[1]) + if(this.db.quoteArrs.hasOwnProperty(key)) { + this.say(data.channel, q[1] + ': ' + this.db.quoteArrs[key].random()); + } else { + this.say(data.channel, 'Nobody loves ' + q[1]); + } } } } From c9f4995d50dd2d141a28696efc19bf6bf9d12940 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Fri, 9 Dec 2011 15:30:29 +0000 Subject: [PATCH 2/2] fix ban bug --- run.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/run.js b/run.js index a7093f0..a840b3e 100644 --- a/run.js +++ b/run.js @@ -104,12 +104,12 @@ DBot.prototype.reloadModules = function() { this.save(); } } else { - if(this.db.bans['*'].include(data.user)) { - this.say(data.channel, data.user + + var q = data.message.valMatch(/^~([\d\w\s]*)/, 2); + if(q) { + if(this.db.bans['*'].include(data.user)) { + this.say(data.channel, data.user + ' is banned from using this command. Commence incineration.'); - } else { - var q = data.message.valMatch(/^~([\d\w\s]*)/, 2); - if(q) { + } else { q[1] = q[1].trim(); key = this.cleanNick(q[1]) if(this.db.quoteArrs.hasOwnProperty(key)) {