forked from GitHub/dbot
fixing ~rq error on empty quote db
This commit is contained in:
parent
4e6393dd9a
commit
fac4cb73b1
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user