From ab9cfb1469651f3862c7b196e8d2663574d95966 Mon Sep 17 00:00:00 2001 From: reality Date: Sun, 25 Aug 2013 19:04:42 +0000 Subject: [PATCH] fix for not found --- modules/imgur/imgur.js | 4 +++- modules/imgur/strings.json | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/imgur/imgur.js b/modules/imgur/imgur.js index fc6ec00..615df19 100644 --- a/modules/imgur/imgur.js +++ b/modules/imgur/imgur.js @@ -179,12 +179,14 @@ var imgur = function(dbot) { 'q': term } }, function(err, response, body) { - if(body.data) { + if(body.data && body.data[0] != undefined) { this.api.getGalleryInfo(body.data[0].id, function(gal) { event.reply(dbot.t('imgurinfo', { 'info': this.internalAPI.galleryInfoString(gal) }) + ' - ' + gal.data.link); }.bind(this)); + } else { + event.reply(dbot.t('imgur_noresults')); } }.bind(this)); } diff --git a/modules/imgur/strings.json b/modules/imgur/strings.json index b1726d5..335e8d1 100644 --- a/modules/imgur/strings.json +++ b/modules/imgur/strings.json @@ -6,11 +6,14 @@ "nl": "bevat mogelijk gevoelige beelden", "de": "Könnte 18+ Material enthalten", "fr": "peut être risqué pour le travail (NSFW)", - "it": "può essere rischioso al lavoro (NSFW)" + "it": "può essere rischioso al lavoro (NSFW)" }, "imgurinfo": { "en": "[{info}]", "fr": "[{info}]", - "it": "[{info}]" + "it": "[{info}]" + }, + "imgur_noresults": { + "en": "No results found." } }