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/plugins/cats.lua
topkecleon 60570e90f3 added cron jobs for plugins
added example plugin with documentation
added liberbot-compliant flood control
	see Liberbot Support for details on getting compliant
added Kickass Torrent plugin
various bugfixes
all files seem to have been marked changed due to a shift in platform
	I will do a clean clone and testing to ensure there is no issue.
2015-08-28 23:15:01 -07:00

34 lines
562 B
Lua
Executable File

local doc = [[
/cat
Get a cat pic!
]]
local triggers = {
'^/cats?'
}
local action = function(msg)
local url = 'http://thecatapi.com/api/images/get?format=html&type=jpg'
if config.thecatapi_key then
url = url .. '&api_key=' .. config.thecatapi_key
end
local jstr, res = HTTP.request(url)
if res ~= 200 then
return send_msg(msg, config.locale.errors.connection)
end
jstr = jstr:match('<img src="(.*)">')
send_message(msg.chat.id, jstr, false, msg.message_id)
end
return {
doc = doc,
triggers = triggers,
action = action,
typing = true
}