telegrambot: add a polling timeout aka wait for a while

Tamara Schmitz 2023-02-21 10:16:21 +01:00
parent ee266ad547
commit 84acc6aa5a
Signed by: tamtaram
GPG Key ID: C2613AC6B3FA4686
1 changed files with 3 additions and 2 deletions

View File

@ -13,9 +13,10 @@ class TelegramBot(Bot):
seen_tg = user.get_seen_tg()
try:
updates = tb.get_updates(offset=seen_tg + 1,
allowed_updates="message").wait()
allowed_updates="message",
timeout=15).wait()
except TypeError:
updates = tb.get_updates().wait()
updates = tb.get_updates(timeout=15).wait()
reports = []
if updates == None:
return reports