forked from GitHub/dbot
that should do it
This commit is contained in:
parent
ef4ceac61e
commit
bf996f2fd1
@ -109,7 +109,7 @@ var imgur = function(dbot) {
|
|||||||
'getGoodRandomImage': function(callback) {
|
'getGoodRandomImage': function(callback) {
|
||||||
this.api.getRandomImage(function(url, slug, hash) {
|
this.api.getRandomImage(function(url, slug, hash) {
|
||||||
this.api.getImageInfo(slug, function(imgData) {
|
this.api.getImageInfo(slug, function(imgData) {
|
||||||
if(imgData && imgData.data && imgData.data.height > 500 && imgData.data.width > 500) {
|
if(!_.isUndefined(imgData) && imgData.data && imgData.data.height > 500 && imgData.data.width > 500) {
|
||||||
callback(url, imgData);
|
callback(url, imgData);
|
||||||
} else {
|
} else {
|
||||||
this.api.getGoodRandomImage(callback);
|
this.api.getGoodRandomImage(callback);
|
||||||
@ -220,7 +220,7 @@ var imgur = function(dbot) {
|
|||||||
'Authorization': 'Client-ID ' + this.config.apikey
|
'Authorization': 'Client-ID ' + this.config.apikey
|
||||||
}
|
}
|
||||||
}, function(err, response, body) {
|
}, function(err, response, body) {
|
||||||
if(body.data && body.data[0] != undefined) {
|
if(!_.isUndefined(body) && body.data && body.data[0] != undefined) {
|
||||||
var num = _.random(0, body.data.length - 1);
|
var num = _.random(0, body.data.length - 1);
|
||||||
this.api.getGalleryInfo(body.data[num].id, function(gal) {
|
this.api.getGalleryInfo(body.data[num].id, function(gal) {
|
||||||
event.reply(local + ': ' + gal.data.link + ' [' +
|
event.reply(local + ': ' + gal.data.link + ' [' +
|
||||||
|
Loading…
Reference in New Issue
Block a user