32 lines
779 B
Lua
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 |