From b53b318ab9b81f9a50eb2bbfaaf11fce48077473 Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Mon, 4 Jul 2016 02:55:39 +0200 Subject: [PATCH] gImages: Fix, wenn kein Bild gefunden wird --- otouto/plugins/gImages.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/otouto/plugins/gImages.lua b/otouto/plugins/gImages.lua index a87e371..d63e430 100644 --- a/otouto/plugins/gImages.lua +++ b/otouto/plugins/gImages.lua @@ -37,6 +37,9 @@ function gImages:callback(callback, msg, self, config, input) if img_url == 403 then utilities.send_reply(self, msg, config.errors.quotaexceeded, true) return + elseif img_url == 'NORESULTS' then + utilities.send_reply(self, msg, config.errors.results, true) + return elseif not img_url then utilities.send_reply(self, msg, config.errors.connection, true) return @@ -77,8 +80,7 @@ function gImages:get_image(input) if jdat.searchInformation.totalResults == '0' then - utilities.send_reply(self, msg, config.errors.results, true) - return + return 'NORESULTS' end local i = math.random(jdat.queries.request[1].count) @@ -107,6 +109,9 @@ function gImages:action(msg, config, matches) if img_url == 403 then utilities.send_reply(self, msg, config.errors.quotaexceeded, true) return + elseif img_url == 'NORESULTS' then + utilities.send_reply(self, msg, config.errors.results, true) + return elseif not img_url then utilities.send_reply(self, msg, config.errors.connection, true) return