Update giphy.lua
This commit is contained in:
parent
edfbe6eec4
commit
84b7062aed
@ -16,6 +16,7 @@ end
|
|||||||
|
|
||||||
function search(text)
|
function search(text)
|
||||||
local res, code = http.request(BASE_URL.."/gifs/search?q="..text.."&api_key="..API_KEY)
|
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
|
local images = json:decode(res).data
|
||||||
if #images == 0 then return nil end -- No images
|
if #images == 0 then return nil end -- No images
|
||||||
local i = math.random(0,#images)
|
local i = math.random(0,#images)
|
||||||
@ -56,4 +57,4 @@ return {
|
|||||||
run = run
|
run = run
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user