Merge Upstream

This commit is contained in:
Akamaru 2016-12-04 21:44:33 +01:00
commit d86d2ed844
2 changed files with 14 additions and 1 deletions

View File

@ -226,7 +226,7 @@ function bot:run(config)
while self.is_started do
-- Update loop
local res = bindings.getUpdates{ timeout = 20, offset = self.last_update+1 }
local res = bindings.getUpdates{ timeout = 120, offset = self.last_update+1, allowed_updates = {'message', 'inline_query', 'callback_query'} }
if res then
-- Iterate over every new message.
for n=1, #res.result do

View File

@ -132,6 +132,19 @@ function send_youtube_data(data, msg, self, link, sendpic)
if sendpic then
local image_url = get_yt_thumbnail(data)
-- need to change text, because Telegram captions can only be 200 characters long and don't support Markdown
-- hacky workaround
if data.statistics.likeCount then
likeCount = ' | 👍 '..comma_value(data.statistics.likeCount)..' |'
dislikeCount = ' 👎 '..comma_value(data.statistics.dislikeCount)
else
likeCount = ''
dislikeCount = ''
end
if data.statistics.commentCount then
commentCount = ' | 🗣 '..comma_value(data.statistics.commentCount)
else
commentCount = ''
end
local text = link..'\n'..title..'\n🎥 '..uploader..', 📅 '..upload_date..'\n👁 '..viewCount..' | 🕒 '..duration..likeCount..dislikeCount..commentCount..'\n'
if blocked then
text = text..'\nACHTUNG, In Deutschland gesperrt!'