diff --git a/modules/quotes/quotes.js b/modules/quotes/quotes.js index 1d0b842..0bc18c3 100644 --- a/modules/quotes/quotes.js +++ b/modules/quotes/quotes.js @@ -13,7 +13,7 @@ var quotes = function(dbot) { 'interpolatedQuote': function(server, channel, key, quote, callback) { var quoteRefs = quote.match(/~~([\d\w\s-]*)~~/g); if(quoteRefs) { - var ref = dbot.cleanNick(quoteRefs[0].replace(/^~~/,'').replace(/~~$/,'').trim()); + var ref = this.internalAPI.cleanRef(quoteRefs[0].replace(/^~~/,'').replace(/~~$/,'').trim()); if(ref === '-nicks-') { dbot.api.users.getRandomChannelUser(server, channel, function(user) { quote = quote.replace('~~' + ref + '~~', randomNick); @@ -33,6 +33,14 @@ var quotes = function(dbot) { } }.bind(this), + 'cleanRef': function(key) { + key = key.toLowerCase(); + while(key.endsWith("_")) { + key = key.substring(0, key.length-1); + } + return key; + }, + 'resetRemoveTimer': function(event, key, quote) { this.rmAllowed = false; setTimeout(function() { diff --git a/run.js b/run.js index 2af040c..ced9144 100644 --- a/run.js +++ b/run.js @@ -315,15 +315,4 @@ DBot.prototype.reloadModules = function() { this.save(); }; -DBot.prototype.cleanNick = function(key) { - key = key.toLowerCase(); - while(key.endsWith("_")) { - if(_.has(this.db.quoteArrs, key)) { - return key; - } - key = key.substring(0, key.length-1); - } - return key; -} - new DBot();