From fac4cb73b13d416f9a8ffcc79a074144ee7d6ac9 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Thu, 21 Mar 2013 04:00:07 -0400 Subject: [PATCH] fixing ~rq error on empty quote db --- modules/quotes/commands.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/quotes/commands.js b/modules/quotes/commands.js index 89fc33c..207a30d 100644 --- a/modules/quotes/commands.js +++ b/modules/quotes/commands.js @@ -187,8 +187,12 @@ var commands = function(dbot) { }, '~rq': function(event) { - var category = _.keys(quotes)[_.random(0, _.size(quotes) -1)]; - event.reply(category + ': ' + this.internalAPI.interpolatedQuote(event.server, event.channel.name, category)); + if(_.keys(quotes).length > 0) { + var category = _.keys(quotes)[_.random(0, _.size(quotes) -1)]; + event.reply(category + ': ' + this.internalAPI.interpolatedQuote(event.server, event.channel.name, category)); + } else { + event.reply(dbot.t('no_results')); + } }, '~link': function(event) {