Changes in helper_functions.delete_message

Removed checking if sleep_time is 0
Moved sleeping outside of try block
This commit is contained in:
StNicolay 2023-01-03 12:29:08 +03:00
parent fdbed91512
commit e29eefe40b

View File

@ -40,9 +40,8 @@ async def delete_message(
*, *,
sleep_time: int = 0, sleep_time: int = 0,
) -> bool: ) -> bool:
await asyncio.sleep(sleep_time)
try: try:
if sleep_time != 0:
await asyncio.sleep(sleep_time)
await bot.delete_message(mes.chat.id, mes.id) await bot.delete_message(mes.chat.id, mes.id)
except telebot.apihelper.ApiException: except telebot.apihelper.ApiException:
return False return False