Nutze anderen A
This commit is contained in:
parent
7c0d906b9e
commit
8721f76ba4
@ -7,9 +7,9 @@ local makeOurDate = function(dateString)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function get_post(post)
|
local function get_post(post)
|
||||||
local url = 'http://akamaru.de/?json=get_post&post_id=blub'
|
local url = 'http://akamaru.de/?json=get_recent_posts'
|
||||||
local res,code = http.request(url)
|
local res,code = http.request(url)
|
||||||
local data = json:decode(res).post
|
local data = json:decode(res).posts[1]
|
||||||
if code ~= 200 then return "HTTP-Fehler" end
|
if code ~= 200 then return "HTTP-Fehler" end
|
||||||
if not data then return "HTTP-Fehler" end
|
if not data then return "HTTP-Fehler" end
|
||||||
|
|
||||||
@ -62,11 +62,13 @@ local function get_post(post)
|
|||||||
local url = data.url
|
local url = data.url
|
||||||
if data.thumbnail then
|
if data.thumbnail then
|
||||||
image_url = data.thumbnail
|
image_url = data.thumbnail
|
||||||
|
elseif data.attachments then
|
||||||
|
image_url = data.attachments[1].url
|
||||||
end
|
end
|
||||||
|
|
||||||
local text = title..' ('..from..' am '..date..')\n\n'..content..'...\n'..url
|
local text = title..' ('..from..' am '..date..')\n\n'..content..'...\n'..url
|
||||||
|
|
||||||
if data.thumbnail then
|
if data.thumbnail or data.attachments then
|
||||||
return text, image_url
|
return text, image_url
|
||||||
else
|
else
|
||||||
return text
|
return text
|
||||||
|
@ -7,9 +7,9 @@ local makeOurDate = function(dateString)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function get_post(post)
|
local function get_post(post)
|
||||||
local url = 'https://ponywave.de/?json=get_post&post_id=blub'
|
local url = 'https://ponywave.de/?json=get_recent_posts'
|
||||||
local res,code = https.request(url)
|
local res,code = https.request(url)
|
||||||
local data = json:decode(res).post
|
local data = json:decode(res).posts[1]
|
||||||
if code ~= 200 then return "HTTP-Fehler" end
|
if code ~= 200 then return "HTTP-Fehler" end
|
||||||
if not data then return "HTTP-Fehler" end
|
if not data then return "HTTP-Fehler" end
|
||||||
|
|
||||||
@ -62,11 +62,13 @@ local function get_post(post)
|
|||||||
local url = data.url
|
local url = data.url
|
||||||
if data.thumbnail then
|
if data.thumbnail then
|
||||||
image_url = data.thumbnail
|
image_url = data.thumbnail
|
||||||
|
elseif data.attachments then
|
||||||
|
image_url = data.attachments[1].url
|
||||||
end
|
end
|
||||||
|
|
||||||
local text = title..' ('..from..' am '..date..')\n\n'..content..'...\n'..url
|
local text = title..' ('..from..' am '..date..')\n\n'..content..'...\n'..url
|
||||||
|
|
||||||
if data.thumbnail then
|
if data.thumbnail or data.attachments then
|
||||||
return text, image_url
|
return text, image_url
|
||||||
else
|
else
|
||||||
return text
|
return text
|
||||||
|
Reference in New Issue
Block a user