3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00

Don't shit out if there's no highscore quote category

This commit is contained in:
reality 2013-04-19 17:06:19 +00:00
parent 24b7c2b6b4
commit 146e7afa5b

View File

@ -3,9 +3,14 @@ var _ = require('underscore')._;
var pages = function(dbot) {
return {
'/imgur/random': function(req, res) {
var hs = dbot.db.quoteArrs[dbot.config.imgur.highscore];
hs = hs[hs.length-1];
res.render('imgurr', {"highscore" : hs });
var quoteCat = dbot.db.quoteArrs[dbot.config.imgur.highscore],
highScore = 0;
if(quoteCat) {
highScore = _.last(quoteCat);
}
res.render('imgurr', { "highscore" : highScore });
},
'/imgur/stats': function(req, res) {