Neu Openings.moe Plugin

Ignoriere openings.moe in media.lua und url_title.lua
This commit is contained in:
Akamaru 2015-11-26 15:18:47 +01:00
parent 76b931fb64
commit d51ee9bf1d
3 changed files with 37 additions and 1 deletions

View File

@ -10,7 +10,10 @@ local function run(msg, matches)
local mime_type = mimetype.get_content_type_no_sub(ext)
if ext == 'gif' then
if string.match(url, "openings.moe/%?video") then
print('Ungültig, da "'..url..'"')
elseif ext == 'gif' then
print('Sende Datei')
send_document(receiver, file, rmtmp_cb, cb_extra)

32
plugins/openings_moe.lua Normal file
View File

@ -0,0 +1,32 @@
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

View File

@ -92,6 +92,7 @@ function run(msg, matches)
string.match(msg.text, "urbandictionary.com/define.php")or
string.match(msg.text, "wikia.com") or
string.match(msg.text, "rule34.xxx/index.php") or
string.match(msg.text, "openings.moe/%?video") or
string.match(msg.text, "dropbox.com/s/") then
print('Ungültig, da "'..title..'"')
else