Merge Upstream

This commit is contained in:
Akamaru 2016-09-21 22:48:15 +02:00
commit ec860ed58a

View File

@ -60,7 +60,6 @@ function twitter:action(msg, config, matches)
verified = '' verified = ''
end end
local header = '<b>Tweet von '..full_name..'</b> (<a href="https://twitter.com/'..user_name..'">@' ..user_name..'</a>'..verified..'):' local header = '<b>Tweet von '..full_name..'</b> (<a href="https://twitter.com/'..user_name..'">@' ..user_name..'</a>'..verified..'):'
local text = response.text local text = response.text
-- favorites & retweets -- favorites & retweets
@ -100,18 +99,18 @@ function twitter:action(msg, config, matches)
if response.entities.media and response.extended_entities.media then if response.entities.media and response.extended_entities.media then
for k, v in pairs(response.extended_entities.media) do for k, v in pairs(response.extended_entities.media) do
local url = v.url local url = v.url
local pic = v.media_url_https
if v.video_info then if v.video_info then
if not v.video_info.variants[3] then if v.video_info.variants[#v.video_info.variants].bitrate == 2176000 then
local vid = v.video_info.variants[1].url local vid = v.video_info.variants[#v.video_info.variants].url
videos[#videos+1] = vid videos[#videos+1] = vid
else else
local vid = v.video_info.variants[3].url local vid = v.video_info.variants[1].url
videos[#videos+1] = vid videos[#videos+1] = vid
end end
end else
text = text:gsub(url, "") images[#images+1] = v.media_url_https
images[#images+1] = pic end
text = text:gsub(url, '')
end end
end end
@ -130,8 +129,7 @@ function twitter:action(msg, config, matches)
end end
-- send the parts -- send the parts
utilities.send_reply(msg, header .. "\n" .. text.."\n"..footer, 'HTML') utilities.send_reply(msg, header .. "\n" .. utilities.trim(text).."\n"..footer, 'HTML')
if videos[1] then images = {} end
for k, v in pairs(images) do for k, v in pairs(images) do
local file = download_to_file(v) local file = download_to_file(v)
utilities.send_photo(msg.chat.id, file, nil, msg.message_id) utilities.send_photo(msg.chat.id, file, nil, msg.message_id)