24 lines
575 B
Python
24 lines
575 B
Python
|
import logging
|
||
|
|
||
|
from load import dp,bot
|
||
|
import config
|
||
|
|
||
|
from aiogram.utils.exceptions import Unauthorized
|
||
|
|
||
|
|
||
|
@dp.errors_handler()
|
||
|
async def errors_handler(update, exception):
|
||
|
if (isinstance(exception,Unauthorized)):
|
||
|
logging.info(f"Unathorized:{config.token}")
|
||
|
return True
|
||
|
|
||
|
await update.message.answer("Error happaned!\nBot terminated!")
|
||
|
|
||
|
await bot.send_message(
|
||
|
config.telegram_log_chat_id,
|
||
|
f"**Bot terminated**!\nException:{exception}",
|
||
|
parse_mode="Markdown"
|
||
|
)
|
||
|
|
||
|
logging.info(f"Bot terminated!Exception:{exception}")
|