Entferne THC & PonyWave

This commit is contained in:
Akamaru 2017-01-24 21:05:40 +01:00
parent cf794728c9
commit 4f3aef6493

View File

@ -2,11 +2,7 @@ local wordpress_recent_post = {}
wordpress_recent_post.triggers = { wordpress_recent_post.triggers = {
"^/([Aa][Kk][Aa]) (.+)$", "^/([Aa][Kk][Aa]) (.+)$",
"^/([Tt][Hh][Cc]) (.+)$",
"^/([Pp][Ww]) (.+)$",
"^/([Aa][Kk][Aa])$", "^/([Aa][Kk][Aa])$",
"^/([Tt][Hh][Cc])$",
"^/([Pp][Ww])$"
} }
local makeOurDate = function(dateString) local makeOurDate = function(dateString)
@ -21,11 +17,7 @@ function wordpress_recent_post:get_full_url(blog, tag)
else else
url = blog..'/?json=get_recent_posts' url = blog..'/?json=get_recent_posts'
end end
local doer = http local res, code = https.request(url)
if url:match('^https') then
doer = https
end
local res, code = doer.request(url)
if code ~= 200 then return nil end if code ~= 200 then return nil end
local data = json.decode(res).posts[1] local data = json.decode(res).posts[1]
if not data then return 'NOTFOUND' end if not data then return 'NOTFOUND' end
@ -49,19 +41,12 @@ function wordpress_recent_post:get_full_url(blog, tag)
image_url = nil image_url = nil
end end
local text = '<b>'..title..'</b>\n<i>'..from..' am '..posted_at..'</i>'..content..'\n<a href="'..url..'">Beitrag aufrufen</a>' local text = '<b>'..title..'</b>\n<i>'..from..' am '..posted_at..'</i>'..content..'\n<a href="'..url..'">Beitrag aufrufen.</a>'
return text, image_url return text, image_url
end end
function wordpress_recent_post:action(msg, config, matches) function wordpress_recent_post:action(msg, config, matches)
local blog = matches[1] local blog = 'https://akamaru.de'
if blog:match('[Aa][Kk][Aa]') then
blog = 'http://akamaru.de'
elseif blog:match('[Pp][Ww]') then
blog = 'https://ponywave.de'
elseif blog:match('[Tt][Hh][Cc]') then
blog = 'http://homebrew.cloud'
end
local text, image_url = wordpress_recent_post:get_full_url(blog, matches[2]) local text, image_url = wordpress_recent_post:get_full_url(blog, matches[2])
if not text then if not text then
utilities.send_reply(msg, config.errors.connection) utilities.send_reply(msg, config.errors.connection)