fixing ~rq error on empty quote db

This commit is contained in:
John Maguire 2013-03-21 04:00:07 -04:00
parent 4e6393dd9a
commit fac4cb73b1

View File

@ -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) {