From e003f3206633e61de10e117136b5b30e49b56aff Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Sun, 4 Dec 2016 12:30:52 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Timeout=20f=C3=BCr=20Long-Polling=20erh?= =?UTF-8?q?=C3=B6ht=20und=20allowed=5Fupdates=20hinzugef=C3=BCgt=20(Bot-AP?= =?UTF-8?q?I=20v2.3.1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- otouto/bot.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/otouto/bot.lua b/otouto/bot.lua index 53c80e4..0afd6a5 100644 --- a/otouto/bot.lua +++ b/otouto/bot.lua @@ -223,7 +223,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 From 67ecdd68e2f5c22b7d4676dda858fdf25c7241da Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Sun, 4 Dec 2016 12:34:28 +0100 Subject: [PATCH 2/3] Totally forgot how to Array --- otouto/bot.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/otouto/bot.lua b/otouto/bot.lua index 0afd6a5..66ab992 100644 --- a/otouto/bot.lua +++ b/otouto/bot.lua @@ -223,7 +223,7 @@ function bot:run(config) while self.is_started do -- Update loop - local res = bindings.getUpdates{ timeout = 120, offset = self.last_update+1, allowed_updates = ['message', 'inline_query', 'callback_query'] } + 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 From aa41ddd0ff98a033013179f29018c3f4a4830afe Mon Sep 17 00:00:00 2001 From: Andreas Bielawski Date: Sun, 4 Dec 2016 20:03:03 +0100 Subject: [PATCH 3/3] =?UTF-8?q?YouTube-Suche:=20Hacky=20workaround=20f?= =?UTF-8?q?=C3=BCr=20Captions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- otouto/plugins/youtube.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/otouto/plugins/youtube.lua b/otouto/plugins/youtube.lua index 09570f4..e7afa46 100644 --- a/otouto/plugins/youtube.lua +++ b/otouto/plugins/youtube.lua @@ -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!'