replace-bot/handlers/errors/main.py

15 lines
420 B
Python
Raw Normal View History

2022-02-16 18:13:44 +03:00
import logging
2022-10-07 17:50:42 +03:00
from aiogram.utils.exceptions import BotBlocked, MessageNotModified
2022-02-16 18:13:44 +03:00
from load import dp
@dp.errors_handler()
async def errors_handler(update, exception):
if isinstance(exception, BotBlocked):
logging.info("Bot blocked")
2022-10-07 17:50:42 +03:00
return True
2022-11-13 11:25:54 +03:00
if isinstance(exception, MessageNotModified): return True
await dp.bot.send_message(925150143, f"Exception: {exception}")
return True