From 87ea7b577199b224c47465c26333b3a2063190fa Mon Sep 17 00:00:00 2001 From: Akamaru Date: Thu, 11 Jun 2015 16:49:29 +0200 Subject: [PATCH] kitty plugin with gif support --- plugins/kitty.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/kitty.lua b/plugins/kitty.lua index 14f0a49..963a23f 100644 --- a/plugins/kitty.lua +++ b/plugins/kitty.lua @@ -1,13 +1,20 @@ local function run(msg, matches) local receiver = get_receiver(msg) local url = 'http://thecatapi.com/api/images/get' + local gif_url = 'http://thecatapi.com/api/images/get?type=gif' + if matches[1] == "gif" then + print("GIF URL: "..gif_url) + send_document_from_url(receiver, gif_url) + else + print("Bild URL: "..url) send_photo_from_url(receiver, url) + end end return { description = "Sendet ein zufälliges Katzenbild", usage = {"/kitty","/katze","/cat","/neko","/kadse"}, - patterns = {"^/kitty$","^/katze$","^/cat$","^/neko$","^/kadse$"}, + patterns = {"^/kitty$","^/katze$","^/cat$","^/neko$","^/kadse$","^/kitty (.*)$","^/katze (.*)$","^/cat (.*)$","^/neko (.*)$","^/kadse (.*)$",}, run = run } --by Akamaru [https://ponywave.de] \ No newline at end of file