Skip to content

Commit

Permalink
Merge pull request #1707 from S1RANN/master
Browse files Browse the repository at this point in the history
raise other exceptions in antiflood function
  • Loading branch information
Badiboy authored Sep 13, 2022
2 parents a1c77db + a06b4a1 commit 8d9dfcf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions telebot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 8d9dfcf

Please sign in to comment.