This commit is contained in:
Andreas Bielawski 2017-01-10 23:53:16 +01:00
parent 8f392538ee
commit 248ab78062
2 changed files with 9 additions and 12 deletions

View File

@ -44,16 +44,12 @@ function gImages:get_image(input)
local jstr, res = https.request(url) local jstr, res = https.request(url)
local jdat = json.decode(jstr).items local jdat = json.decode(jstr).items
if not jdat then if res == 403 then
return 'NORESULTS' return 403
end end
if jdat.error then if not jdat then
if jdat.error.code == 403 then return 'NORESULTS'
return 403
else
return false
end
end end
return jdat return jdat

View File

@ -2,13 +2,14 @@ local respond = {}
function respond:init(config) function respond:init(config)
respond.triggers = { respond.triggers = {
"/[Ss][Hh][Rr][Uu][Gg]",
"([Ff][Gg][Tt].? [Ss][Ww][Ii][Ff][Tt])", "([Ff][Gg][Tt].? [Ss][Ww][Ii][Ff][Tt])",
"([Ee][Ii][Nn][Zz][Ii][Gg][Ss][Tt][Ee][Ss])", "([Ee][Ii][Nn][Zz][Ii][Gg][Ss][Tt][Ee][Ss])",
"([Ee][Ii][Nn][Zz][Ii][Gg][Ss][Tt][Ee][Rr])", "([Ee][Ii][Nn][Zz][Ii][Gg][Ss][Tt][Ee][Rr])",
"([Ee][Ii][Nn][Zz][Ii][Gg][Ss][Tt][Ee])", "([Ee][Ii][Nn][Zz][Ii][Gg][Ss][Tt][Ee])",
"^[Bb][Oo][Tt]%??$", "^[Bb][Oo][Tt]%??$",
"^/([Ll][Oo][Dd])$", "^/([Ll][Oo][Dd])$",
"^/([Ll][Ff])$", "/([Ll][Ff])",
"^/([Kk][Aa])$", "^/([Kk][Aa])$",
"^/([Ii][Dd][Kk])$", "^/([Ii][Dd][Kk])$",
"^/([Nn][Bb][Cc])$", "^/([Nn][Bb][Cc])$",
@ -71,7 +72,7 @@ function respond:action(msg, config, matches)
elseif string.match(msg.text, "[Ll][Ff]") then elseif string.match(msg.text, "[Ll][Ff]") then
utilities.send_message(receiver, '( ͡° ͜ʖ ͡°)') utilities.send_message(receiver, '( ͡° ͜ʖ ͡°)')
return return
elseif string.match(msg.text, "[Nn][Bb][Cc]") or string.match(msg.text, "[Ii][Dd][Cc]") or string.match(msg.text, "[Kk][Aa]") or string.match(msg.text, "[Ii][Dd][Kk]") then elseif string.match(msg.text, "[Nn][Bb][Cc]") or string.match(msg.text, "[Ii][Dd][Cc]") or string.match(msg.text, "[Kk][Aa]") or string.match(msg.text, "[Ii][Dd][Kk]") or string.match(msg.text, "/[Ss][Hh][Rr][Uu][Gg]") then
utilities.send_message(receiver, [[¯\_(ツ)_/¯]]) utilities.send_message(receiver, [[¯\_(ツ)_/¯]])
return return
elseif string.match(msg.text, "[Ff][Rr][Oo][Ss][Cc][Hh]") then elseif string.match(msg.text, "[Ff][Rr][Oo][Ss][Cc][Hh]") then