This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot-2/miku/plugins/justkitten.lua

26 lines
661 B
Lua
Raw Normal View History

2016-08-17 18:29:52 +02:00
local jk = {}
function jk:init(config)
jk.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('jk', true).table
jk.doc = '\n*/jk*'
end
jk.command = 'jk'
function jk:action(msg, config)
local JK_URL = 'https://anditest.perseus.uberspace.de/plugins/jk'
local jk_pics = {
"/justkitten1.jpg",
"/justkitten2.jpg",
"/justkitten3.jpg",
"/justkitten4.jpg",
"/justkitten5.jpg",
"/justkitten6.jpg"
}
local random_pic = math.random(#jk_pics)
2016-08-24 17:18:17 +02:00
utilities.send_typing(msg.chat.id, 'upload_photo')
2016-08-17 18:29:52 +02:00
local file = download_to_file(JK_URL..jk_pics[random_pic])
2016-08-24 17:18:17 +02:00
utilities.send_photo(msg.chat.id, file)
2016-08-17 18:29:52 +02:00
end
return jk