mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Merge pull request #1707 from S1RANN/master
raise other exceptions in antiflood function
This commit is contained in:
commit
8d9dfcfac8
@ -647,15 +647,15 @@ def antiflood(function: Callable, *args, **kwargs):
|
||||
"""
|
||||
from telebot.apihelper import ApiTelegramException
|
||||
from time import sleep
|
||||
msg = None
|
||||
|
||||
try:
|
||||
msg = function(*args, **kwargs)
|
||||
return function(*args, **kwargs)
|
||||
except ApiTelegramException as ex:
|
||||
if ex.error_code == 429:
|
||||
sleep(ex.result_json['parameters']['retry_after'])
|
||||
msg = function(*args, **kwargs)
|
||||
finally:
|
||||
return msg
|
||||
return function(*args, **kwargs)
|
||||
else:
|
||||
raise
|
||||
|
||||
|
||||
def parse_web_app_data(token: str, raw_init_data: str):
|
||||
|
Loading…
Reference in New Issue
Block a user