Skip to content

Commit

Permalink
raise other exceptions in antiflood
Browse files Browse the repository at this point in the history
  • Loading branch information
S1RANN committed Sep 10, 2022
1 parent 783beb1 commit a06b4a1
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions telebot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,19 +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)
return function(*args, **kwargs)
else:
raise
except:
raise
finally:
return msg


def parse_web_app_data(token: str, raw_init_data: str):
Expand Down

0 comments on commit a06b4a1

Please sign in to comment.