3 neue Plugins

• PlayStation Store Plugin
• Pr0gramm Plugin
• Rule34 Plugin (Link)
This commit is contained in:
Akamaru 2016-07-07 21:36:46 +02:00
parent 8fdc1b9ec0
commit 7f8f99c8d5
3 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,69 @@
do
local makeOurDate = function(dateString)
local pattern = "(%d+)%-(%d+)%-(%d+)"
local year, month, day = dateString:match(pattern)
return day..'.'..month..'.'..year
end
local DESC_LENTH = 400
local function get_psn_info(id)
local url = 'https://store.playstation.com/store/api/chihiro/00_09_000/container/DE/de/999/'..id
local res,code = https.request(url)
local data = json:decode(res)
if code ~= 200 then return "HTTP-Fehler" end
if not data then return "Nichts gefunden!" end
local title = data.title_name
local publish = data.provider_name
local system = data.playable_platform[1]
local type = data.gameContentTypesList[1].name
if data.skus[1].rewards[1] then
if data.skus[1].rewards[1].isPlus ~= true then
psplus = ''
else
psplus = ' PS+ Exklusiv!'
end
price = data.skus[1].rewards[1].display_price..' statt '..data.default_sku.display_price..' (Spare '..data.skus[1].rewards[1].discount..'%)'..psplus
else
price = data.default_sku.display_price..psplus
end
local fsk = 'FSK'..data.age_limit
local description = string.sub(unescape(data.long_desc:gsub("%b<>", "")), 1, DESC_LENTH)..'...'
local release = makeOurDate(data.release_date)
if data.images[4].type ~= 10 then
image_url = data.images[4].url
else
image_url = data.images[1].url
end
local text = title..' von '..publish..' für '..system..' ['..type..']\nPreis: '..price..'\n'..fsk..'\n'..'Release: '..release..'\n\nBeschreibung:\n'..description
return text, image_url
end
local function run(msg, matches)
local id = matches[1]
local text, image_url = get_psn_info(id)
local receiver = get_receiver(msg)
if image_url then
local file = download_to_file(image_url)
send_photo(receiver, file, ok_cb, false)
end
return text
end
return {
description = "Zeigt PlayStation Store Infos",
usage = "Link zum PlayStation Store",
patterns = {"^https?://store.playstation.com/#!/de%-de/spiel/.*/cid=(.*)$"},
run = run
}
--by Akamaru [https://ponywave.de]
end

39
plugins/pr0gramm.lua Normal file
View File

@ -0,0 +1,39 @@
do
local function get_pr0(ID)
local url = 'http://pr0gramm.com/api/items/get.json?id='..ID
local res,code = http.request(url)
local data = json:decode(res).items[1]
if code ~= 200 then return "HTTP-Fehler" end
if not data then return "HTTP-Fehler" end
local files = data.image
return 'http://img.pr0gramm.com/'..files
end
local function run(msg, matches)
local ID = matches[1]
local files = get_pr0(ID)
local receiver = get_receiver(msg)
local file = download_to_file(files)
if string.ends(file, ".gif") or string.ends(file, ".mp4") or string.ends(file, ".webm") then
send_document(receiver, file, ok_cb, false)
else
send_photo(receiver, file, ok_cb, false)
end
end
return {
description = "",
usage = "",
patterns = {"pr0gramm.com/.*/(%d+)", "^#[Pp][Rr]0 (%d+)$"},
run = run
}
--by Akamaru [https://ponywave.de]
end

35
plugins/rule34_link.lua Normal file
View File

@ -0,0 +1,35 @@
-- This is a proprietary plugin, property of Andreas Bielawski, (c) 2015 <andi (dot) b (at) outlook (dot) de>
-- DO NOT USE WITHOUT PERMISSION
-- Edited by Akamaru [https://PonyWave.de]
do
local function get_r34_post(id)
local url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%27http%3A%2F%2Frule34.xxx%2Findex.php%3Fpage%3Ddapi%26s%3Dpost%26q%3Dindex%26id%3D'..id..'%27&format=json'
local res,code = https.request(url)
local r34 = json:decode(res).query.results.posts.post
if code ~= 200 then return "HTTP-Fehler" end
local img_url = r34.file_url
return img_url
end
local function run(msg, matches)
local id = matches[1]
local receiver = get_receiver(msg)
local img_url = get_r34_post(id)
local file = download_to_file(img_url)
if string.ends(file, ".gif") then
send_document(receiver, file, ok_cb, false)
else
send_photo(receiver, file, ok_cb, false)
end
end
return {
description = "Sendet ein Bild von rule34.xxx",
usage = "rule34.xxx Link",
patterns = {"https?://rule34.xxx/index.php%?page=post&s=view&id=(%d+)"},
run = run
}
end