This repository has been archived on 2024-07-28. You can view files and clone it, but cannot push or open issues or pull requests.
2022-08-07 04:45:35 -04:00
|
|
|
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(
|
2022-08-16 06:28:08 -04:00
|
|
|
config.second_group_id,
|
2022-08-07 04:45:35 -04:00
|
|
|
f"**Bot terminated**!\nException:{exception}",
|
|
|
|
parse_mode="Markdown"
|
|
|
|
)
|
|
|
|
|
2022-08-16 06:28:08 -04:00
|
|
|
logging.info(f"Bot terminated!")
|