From 1acf5679163a76c540adfba6018a827349deec75 Mon Sep 17 00:00:00 2001 From: Egg Date: Sun, 21 May 2023 23:35:08 +0200 Subject: [PATCH] decrease telegram timeout, add sleep for ratelimit --- active_bots/telegrambot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/active_bots/telegrambot.py b/active_bots/telegrambot.py index 401b8a6..f9a3f94 100644 --- a/active_bots/telegrambot.py +++ b/active_bots/telegrambot.py @@ -14,9 +14,9 @@ class TelegramBot(Bot): try: updates = tb.get_updates(offset=seen_tg + 1, allowed_updates="message", - timeout=15).wait() + timeout=5).wait() except TypeError: - updates = tb.get_updates(timeout=15).wait() + updates = tb.get_updates(timeout=5).wait() reports = [] if updates == None: return reports @@ -88,6 +88,7 @@ class TelegramBot(Bot): try: for subscriber_id in user.get_telegram_subscribers(): tb.send_message(subscriber_id, text).wait() + sleep(0.5) except Exception: logger.error('Error telegramming: ' + user.get_city() + ': ' + str(report.id), exc_info=True)