diff --git a/modules/quotes.js b/modules/quotes.js index f4465d6..9d6af82 100644 --- a/modules/quotes.js +++ b/modules/quotes.js @@ -3,7 +3,7 @@ var quotes = function(dbot) { var commands = { '~q': function(data, params) { - var q = data.message.valMatch(/^~q ([\d\w\s]*)/, 2) + var q = data.message.valMatch(/^~q ([\d\w\s]*)/, 2); if(q) { key = q[1].trim().toLowerCase(); if(quotes.hasOwnProperty(key)) { diff --git a/run.js b/run.js index 80fa5b3..8ee5b7f 100644 --- a/run.js +++ b/run.js @@ -76,9 +76,14 @@ DBot.prototype.reloadModules = function() { this.commands[params[0]](data, params); this.save(); } else { - var q = data.message.valMatch(/^~([\d\w\s]*)/, 2) + var q = data.message.valMatch(/^~([\d\w\s]*)/, 2); if(q) { - this.say(data.channel, this.quotes.get(q[1].trim())); + key = q[1].trim().toLowerCase(); + if(this.db.quoteArrs.hasOwnProperty(key)) { + this.say(data.channel, key + ': ' + this.db.quoteArrs[key].random()); + } else { + this.say(data.channel, 'No quotes under ' + key); + } } } }.bind(this));