pick random result for ~imgur

This commit is contained in:
reality 2013-08-25 20:45:47 +00:00
parent cb38352519
commit 69f061c671

View File

@ -180,7 +180,8 @@ var imgur = function(dbot) {
} }
}, function(err, response, body) { }, function(err, response, body) {
if(body.data && body.data[0] != undefined) { if(body.data && body.data[0] != undefined) {
this.api.getGalleryInfo(body.data[0].id, function(gal) { var num = _.random(0, body.data.length - 1);
this.api.getGalleryInfo(body.data[num].id, function(gal) {
event.reply(dbot.t('imgurinfo', { event.reply(dbot.t('imgurinfo', {
'info': this.internalAPI.galleryInfoString(gal) 'info': this.internalAPI.galleryInfoString(gal)
}) + ' - ' + gal.data.link); }) + ' - ' + gal.data.link);