39 lines
885 B
Lua
39 lines
885 B
Lua
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 |