From f3e31925af22bcc075da4328fa65a6a82cc67fe1 Mon Sep 17 00:00:00 2001 From: Luke Slater Date: Wed, 15 Feb 2012 20:39:11 +0000 Subject: [PATCH] not in all messages.. --- run.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/run.js b/run.js index bbb93f6..d548620 100644 --- a/run.js +++ b/run.js @@ -108,22 +108,22 @@ DBot.prototype.reloadModules = function() { this.save(); } } else { - // See if it's similar to anything - var winnerDistance = Infinity; - var winner = false; - for(var commandName in this.commands) { - var distance = String.prototype.distance(params[0], commandName); - if(distance < winnerDistance) { - winner = commandName; - winnerDistance = distance; + var q = data.message.valMatch(/^~([\d\w\s-]*)/, 2); + if(q) { + // See if it's similar to anything + var winnerDistance = Infinity; + var winner = false; + for(var commandName in this.commands) { + var distance = String.prototype.distance(params[0], commandName); + if(distance < winnerDistance) { + winner = commandName; + winnerDistance = distance; + } } - } - if(winnerDistance < 3) { - this.say(data.channel, 'Did you mean ' + winner + '? Learn to type, hippie!'); - } else { // See if there's anything in quotes - var q = data.message.valMatch(/^~([\d\w\s-]*)/, 2); - if(q) { + if(winnerDistance < 3) { + this.say(data.channel, 'Did you mean ' + winner + '? Learn to type, hippie!'); + } else { // See if there's anything in quotes if(this.db.bans['*'].include(data.user)) { this.say(data.channel, data.user + ' is banned from using this command. Commence incineration.');