Update giphy.lua

This commit is contained in:
Yago 2015-02-27 21:23:23 +01:00
parent edfbe6eec4
commit 84b7062aed

View File

@ -16,6 +16,7 @@ end
function search(text)
local res, code = http.request(BASE_URL.."/gifs/search?q="..text.."&api_key="..API_KEY)
if code ~= 200 then return nil end
local images = json:decode(res).data
if #images == 0 then return nil end -- No images
local i = math.random(0,#images)
@ -56,4 +57,4 @@ return {
run = run
}
end
end