kitty.lua use thecatapi.com

This commit is contained in:
Akamaru 2015-06-11 16:16:35 +02:00
parent 99391a8667
commit 23e0b9faeb
5 changed files with 5 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

View File

@ -1,18 +1,11 @@
function run(msg, matches)
randomValue = math.random(4)
if randomValue == 1 then
send_photo(get_receiver(msg), "pictures/cats/cat1.jpg", ok_cb, false)
elseif randomValue == 2 then
send_photo(get_receiver(msg), "pictures/cats/cat2.jpg", ok_cb, false)
elseif randomValue == 3 then
send_photo(get_receiver(msg), "pictures/cats/cat3.jpg", ok_cb, false)
elseif randomValue == 4 then
send_photo(get_receiver(msg), "pictures/cats/cat4.jpg", ok_cb, false)
end
local function run(msg, matches)
local receiver = get_receiver(msg)
local url = 'http://thecatapi.com/api/images/get'
send_photo_from_url(receiver, url)
end
return {
description = "Sendet eins von 4 Katzenbilder",
description = "Sendet ein zufälliges Katzenbild",
usage = {"/kitty","/katze","/cat","/neko","/kadse"},
patterns = {"^/kitty$","^/katze$","^/cat$","^/neko$","^/kadse$"},
run = run