Links werden nun mitgesendet

This commit is contained in:
Akamaru 2016-02-02 16:14:57 +01:00
parent 04195d2f6b
commit f23fe5f409

View File

@ -17,10 +17,19 @@ function send_reddit_data(data, receiver)
local title = data[1].data.children[1].data.title local title = data[1].data.children[1].data.title
local author = data[1].data.children[1].data.author local author = data[1].data.children[1].data.author
local subreddit = data[1].data.children[1].data.subreddit local subreddit = data[1].data.children[1].data.subreddit
local selftext = string.sub(unescape(data[1].data.children[1].data.selftext:gsub("%b<>", "")), 1, 300) .. '...' if string.len(data[1].data.children[1].data.selftext) > 300 then
selftext = string.sub(unescape(data[1].data.children[1].data.selftext:gsub("%b<>", "")), 1, 300) .. '...'
else
selftext = unescape(data[1].data.children[1].data.selftext:gsub("%b<>", ""))
end
if not data[1].data.children[1].data.is_self then
url = data[1].data.children[1].data.url
else
url = ''
end
local score = comma_value(data[1].data.children[1].data.score) local score = comma_value(data[1].data.children[1].data.score)
local comments = comma_value(data[1].data.children[1].data.num_comments) local comments = comma_value(data[1].data.children[1].data.num_comments)
local text = author..' in /r/'..subreddit..' ('..score..' Upvotes - '..comments..' Kommentare):\n'..title..'\n'..selftext local text = author..' in /r/'..subreddit..' ('..score..' Upvotes - '..comments..' Kommentare):\n'..title..'\n'..selftext..url
send_msg(receiver, text, ok_cb, false) send_msg(receiver, text, ok_cb, false)
end end