Entferne THC & PonyWave

This commit is contained in:
Akamaru 2017-01-24 21:05:40 +01:00
parent cf794728c9
commit 4f3aef6493
1 changed files with 3 additions and 18 deletions

View File

@ -2,11 +2,7 @@ local wordpress_recent_post = {}
wordpress_recent_post.triggers = {
"^/([Aa][Kk][Aa]) (.+)$",
"^/([Tt][Hh][Cc]) (.+)$",
"^/([Pp][Ww]) (.+)$",
"^/([Aa][Kk][Aa])$",
"^/([Tt][Hh][Cc])$",
"^/([Pp][Ww])$"
}
local makeOurDate = function(dateString)
@ -21,11 +17,7 @@ function wordpress_recent_post:get_full_url(blog, tag)
else
url = blog..'/?json=get_recent_posts'
end
local doer = http
if url:match('^https') then
doer = https
end
local res, code = doer.request(url)
local res, code = https.request(url)
if code ~= 200 then return nil end
local data = json.decode(res).posts[1]
if not data then return 'NOTFOUND' end
@ -49,19 +41,12 @@ function wordpress_recent_post:get_full_url(blog, tag)
image_url = nil
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
end
function wordpress_recent_post:action(msg, config, matches)
local blog = matches[1]
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 blog = 'https://akamaru.de'
local text, image_url = wordpress_recent_post:get_full_url(blog, matches[2])
if not text then
utilities.send_reply(msg, config.errors.connection)