Bla bin zu faul
This commit is contained in:
parent
5576ec3af8
commit
5569f7d94c
@ -28,6 +28,7 @@ local function get_post(post)
|
||||
title = string.gsub(title, "»", "»")
|
||||
title = string.gsub(title, "ß", "ß")
|
||||
title = string.gsub(title, "™", "™")
|
||||
title = string.gsub(title, "&", "&")
|
||||
title = string.gsub(title, "'", "'")
|
||||
title = string.gsub(title, "'", "'")
|
||||
title = string.gsub(title, "|", "|")
|
||||
@ -59,15 +60,27 @@ local function get_post(post)
|
||||
local date = makeOurDate(data.date)
|
||||
local content = string.match(data.excerpt, '<p>(.*)</p>')
|
||||
local url = data.url
|
||||
if data.thumbnail then
|
||||
image_url = data.thumbnail
|
||||
end
|
||||
|
||||
local text = title..' ('..from..' am '..date..')\n\n'..content..'...\n'..url
|
||||
|
||||
if data.thumbnail then
|
||||
return text, image_url
|
||||
else
|
||||
return text
|
||||
end
|
||||
end
|
||||
|
||||
local function run(msg, matches)
|
||||
local text = get_post(post)
|
||||
local text, image_url = get_post(post)
|
||||
local receiver = get_receiver(msg)
|
||||
if image_url then
|
||||
local receiver = get_receiver(msg)
|
||||
local file = download_to_file(image_url)
|
||||
send_photo(receiver, file, ok_cb, false)
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
|
@ -41,7 +41,7 @@ local function fb_post (id, story_id)
|
||||
story = ""
|
||||
end
|
||||
|
||||
local text = from..story..':\n'..message..'\n'..link
|
||||
local text = from..story..' hat gepostet:\n'..message..'\n'..link
|
||||
return text
|
||||
end
|
||||
|
||||
|
@ -92,6 +92,7 @@ local function send_anime_data(result, receiver)
|
||||
end
|
||||
|
||||
local text = title..typ..syno..eng..episodes..status..score..startdate..enddate..'\n'..desc..'\n'..mal_url
|
||||
|
||||
if xml.find(result, 'image') then
|
||||
local image_url = xml.find(result, 'image')[1]
|
||||
local cb_extra = {
|
||||
|
@ -4,7 +4,6 @@ local images_enabled = true;
|
||||
|
||||
local function get_sprite(path)
|
||||
local url = "http://pokeapi.co/"..path
|
||||
print(url)
|
||||
local b,c = http.request(url)
|
||||
local data = json:decode(b)
|
||||
local image = data.image
|
||||
|
94
plugins/ponywave.lua
Normal file
94
plugins/ponywave.lua
Normal file
@ -0,0 +1,94 @@
|
||||
do
|
||||
|
||||
local makeOurDate = function(dateString)
|
||||
local pattern = "(%d+)%-(%d+)%-(%d+)"
|
||||
local year, month, day = dateString:match(pattern)
|
||||
return day..'.'..month..'.'..year
|
||||
end
|
||||
|
||||
local function get_post(post)
|
||||
local url = 'https://ponywave.de/?json=get_post&post_id=blub'
|
||||
local res,code = https.request(url)
|
||||
local data = json:decode(res).post
|
||||
if code ~= 200 then return "HTTP-Fehler" end
|
||||
if not data then return "HTTP-Fehler" end
|
||||
|
||||
local title = data.title
|
||||
-- Character encoding
|
||||
title = string.gsub(title, "´", "´")
|
||||
title = string.gsub(title, "&", "&")
|
||||
title = string.gsub(title, ">", ">")
|
||||
title = string.gsub(title, """, '"')
|
||||
title = string.gsub(title, "<", "<")
|
||||
title = string.gsub(title, "—", "—")
|
||||
title = string.gsub(title, "∇", "∇")
|
||||
title = string.gsub(title, "–", "–")
|
||||
title = string.gsub(title, "Ψ", "ψ")
|
||||
title = string.gsub(title, "ψ", "ψ")
|
||||
title = string.gsub(title, "»", "»")
|
||||
title = string.gsub(title, "ß", "ß")
|
||||
title = string.gsub(title, "™", "™")
|
||||
title = string.gsub(title, "&", "&")
|
||||
title = string.gsub(title, "'", "'")
|
||||
title = string.gsub(title, "'", "'")
|
||||
title = string.gsub(title, "|", "|")
|
||||
title = string.gsub(title, " ", " ")
|
||||
title = string.gsub(title, "»", "»")
|
||||
title = string.gsub(title, "ß", "ß")
|
||||
title = string.gsub(title, "–", "–")
|
||||
title = string.gsub(title, "’", "'")
|
||||
title = string.gsub(title, "“", "“")
|
||||
title = string.gsub(title, "”", "”")
|
||||
title = string.gsub(title, "„", "„")
|
||||
title = string.gsub(title, "‹", "‹")
|
||||
title = string.gsub(title, "€", "€")
|
||||
-- Ä Ö Ü
|
||||
title = string.gsub(title, "ä", "ä")
|
||||
title = string.gsub(title, "Ä", "Ä")
|
||||
title = string.gsub(title, "ä", "ä")
|
||||
title = string.gsub(title, "Ä", "Ä")
|
||||
title = string.gsub(title, "ö", "ö")
|
||||
title = string.gsub(title, "Ö", "Ö")
|
||||
title = string.gsub(title, "ö", "ö")
|
||||
title = string.gsub(title, "Ö", "Ö")
|
||||
title = string.gsub(title, "ü", "ü")
|
||||
title = string.gsub(title, "Ü", "Ü")
|
||||
title = string.gsub(title, "ü", "ü")
|
||||
title = string.gsub(title, "Ü", "Ü")
|
||||
|
||||
local from = data.author.name
|
||||
local date = makeOurDate(data.date)
|
||||
local content = string.match(data.excerpt, '<p>(.*)</p>')
|
||||
local url = data.url
|
||||
if data.thumbnail then
|
||||
image_url = data.thumbnail
|
||||
end
|
||||
|
||||
local text = title..' ('..from..' am '..date..')\n\n'..content..'...\n'..url
|
||||
|
||||
if data.thumbnail then
|
||||
return text, image_url
|
||||
else
|
||||
return text
|
||||
end
|
||||
end
|
||||
|
||||
local function run(msg, matches)
|
||||
local text, image_url = get_post(post)
|
||||
local receiver = get_receiver(msg)
|
||||
if image_url then
|
||||
local receiver = get_receiver(msg)
|
||||
local file = download_to_file(image_url)
|
||||
send_photo(receiver, file, ok_cb, false)
|
||||
end
|
||||
return text
|
||||
end
|
||||
|
||||
return {
|
||||
description = "Sendet letzten PonyWave Beitrag",
|
||||
usage = "/pw",
|
||||
patterns = {"^/[Pp][Ww]$"},
|
||||
run = run
|
||||
}
|
||||
|
||||
end
|
@ -22,6 +22,7 @@ function getTitle(page)
|
||||
s = string.gsub(s, "®", "®")
|
||||
s = string.gsub(s, "ß", "ß")
|
||||
s = string.gsub(s, "™", "™")
|
||||
s = string.gsub(s, "&", "&")
|
||||
s = string.gsub(s, "'", "'")
|
||||
s = string.gsub(s, "'", "'")
|
||||
s = string.gsub(s, "|", "|")
|
||||
@ -64,9 +65,6 @@ end
|
||||
|
||||
function run(msg, matches)
|
||||
local url = matches[1]
|
||||
if string.ends(url, ".jpg") or string.ends(url, ".gif") or string.ends(url, ".png") then
|
||||
return
|
||||
end
|
||||
local result = http.request(url)
|
||||
local title = getTitle(result)
|
||||
|
||||
@ -81,10 +79,11 @@ function run(msg, matches)
|
||||
title == "Object moved" or
|
||||
title == "Error 404 (Not Found)!!1" or
|
||||
title == "Moved Temporarily" or
|
||||
title == "Not Found" or
|
||||
title == "Document Moved" or
|
||||
title == "521: Web server is down" or
|
||||
string.match(title, "on Steam") or
|
||||
string.match(title, "521: Web server is down") or
|
||||
string.match(title, "eBay</title>") or
|
||||
string.match(title, "Document Moved") or
|
||||
string.match(msg.text, "twitch.tv") or
|
||||
string.match(msg.text, "twitter.com") or
|
||||
string.match(msg.text, "steamcommunity.com/app/") or
|
||||
@ -97,7 +96,11 @@ function run(msg, matches)
|
||||
string.match(msg.text, "rule34.xxx/index.php") or
|
||||
string.match(msg.text, "openings.moe/%?video") or
|
||||
string.match(msg.text, "myfigurecollection.net") or
|
||||
string.match(msg.text, "dropbox.com/s/") then
|
||||
string.match(msg.text, "dropbox.com/s/") or
|
||||
string.ends(url, ".jpg") or
|
||||
string.ends(url, ".jpeg") or
|
||||
string.ends(url, ".gif") or
|
||||
string.ends(url, ".png") then
|
||||
print('Ungültig, da "'..title..'"')
|
||||
else
|
||||
return title
|
||||
|
Reference in New Issue
Block a user