gImages: Fix, wenn kein Bild gefunden wird

This commit is contained in:
Andreas Bielawski 2016-07-04 02:55:39 +02:00
parent b089efa34b
commit b53b318ab9

View File

@ -37,6 +37,9 @@ function gImages:callback(callback, msg, self, config, input)
if img_url == 403 then if img_url == 403 then
utilities.send_reply(self, msg, config.errors.quotaexceeded, true) utilities.send_reply(self, msg, config.errors.quotaexceeded, true)
return return
elseif img_url == 'NORESULTS' then
utilities.send_reply(self, msg, config.errors.results, true)
return
elseif not img_url then elseif not img_url then
utilities.send_reply(self, msg, config.errors.connection, true) utilities.send_reply(self, msg, config.errors.connection, true)
return return
@ -77,8 +80,7 @@ function gImages:get_image(input)
if jdat.searchInformation.totalResults == '0' then if jdat.searchInformation.totalResults == '0' then
utilities.send_reply(self, msg, config.errors.results, true) return 'NORESULTS'
return
end end
local i = math.random(jdat.queries.request[1].count) local i = math.random(jdat.queries.request[1].count)
@ -107,6 +109,9 @@ function gImages:action(msg, config, matches)
if img_url == 403 then if img_url == 403 then
utilities.send_reply(self, msg, config.errors.quotaexceeded, true) utilities.send_reply(self, msg, config.errors.quotaexceeded, true)
return return
elseif img_url == 'NORESULTS' then
utilities.send_reply(self, msg, config.errors.results, true)
return
elseif not img_url then elseif not img_url then
utilities.send_reply(self, msg, config.errors.connection, true) utilities.send_reply(self, msg, config.errors.connection, true)
return return