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/plugins/openings_moe.lua
Akamaru d51ee9bf1d Neu Openings.moe Plugin
Ignoriere openings.moe in media.lua und url_title.lua
2015-11-26 15:18:47 +01:00

32 lines
779 B
Lua

do
local function get_opening(opening)
local url = 'http://openings.moe/api/details.php?file='..opening..'.webm'
local res,code = http.request(url)
local data = json:decode(res)
if code ~= 200 then return "HTTP-Fehler" end
if not data then return "HTTP-Fehler" end
local number = data.title
local title = data.source
local url = 'http://openings.moe/video/'..data.filename
local text = number..' von '..title..'\n'..url
return text
end
local function run(msg, matches)
local receiver = get_receiver(msg)
local opening = matches[1]
local text = get_opening(opening)
return text
end
return {
description = "Sendet Infos zu einem Opening",
usage = "Openings.moe Link",
patterns = {"openings.moe/%?video=(.*).webm$"},
run = run
}
end