diff --git a/miku/plugins/reddit.lua b/miku/plugins/reddit.lua index 72d94a0..c80f18a 100644 --- a/miku/plugins/reddit.lua +++ b/miku/plugins/reddit.lua @@ -15,14 +15,14 @@ local format_results = function(posts) local title = post.title:gsub('%[', '('):gsub('%]', ')'):gsub('&', '&') if title:len() > 256 then title = title:sub(1, 253) - title = utilities.trim(title) .. '...' + title = utilities.trim(title)..'...' end - local short_url = 'https://redd.it/' .. post.id - local s = '[' .. unescape(title) .. '](' .. short_url .. ')' + local short_url = 'https://redd.it/'..post.id + local s = ''..unescape(title)..'' if post.domain and not post.is_self and not post.over_18 then - s = '`[`[' .. post.domain .. '](' .. post.url:gsub('%)', '\\)') .. ')`]` ' .. s + s = '['..post.domain..'] '..s end - output = output .. '• ' .. s .. '\n' + output = output..'• '..s..'\n' end return output end @@ -47,17 +47,17 @@ function reddit:action(msg, config) if input then if input:match('^r/.') then input = utilities.get_word(input, 1) - url = reddit.subreddit_url:format(input) .. limit - source = '*/' .. utilities.md_escape(input) .. '*\n' + url = reddit.subreddit_url:format(input)..limit + source = '/'..utilities.md_escape(input)..'\n' else input = utilities.input(msg.text) - source = '*Ergebnisse für* _' .. utilities.md_escape(input) .. '_ *:*\n' + source = 'Ergebnisse für '..utilities.md_escape(input)..' :\n' input = URL.escape(input) - url = reddit.search_url:format(input) .. limit + url = reddit.search_url:format(input)..limit end else - url = reddit.rall_url .. limit - source = '*/r/all*\n' + url = reddit.rall_url..limit + source = '/r/all\n' end local jstr, res = https.request(url) if res ~= 200 then @@ -68,10 +68,11 @@ function reddit:action(msg, config) utilities.send_reply(msg, config.errors.results) else local output = format_results(jdat.data.children) - output = source .. output - utilities.send_message(msg.chat.id, output, true, nil, true) + local redd_link = source:gsub('', '') + output = source..output..'Mehr auf Reddit ansehen.' + utilities.send_reply(msg, output, 'HTML') end end end -return reddit +return reddit \ No newline at end of file