aiogram-bot-template/utils/notify_admins.py

21 lines
580 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from loguru import logger
from aiogram import Dispatcher
from aiogram.utils.exceptions import ChatNotFound
from data.config import ADMINS_ID
async def mail_to_admins(dp):
for admin in ADMINS_ID:
try:
await dp.bot.send_message(admin, "Бот Запущен и готов к работе с группами!")
except ChatNotFound:
logger.error("Чат с админом не найден")
except Exception as err:
logger.exception(err)
async def on_startup_notify(dp: Dispatcher):
await mail_to_admins(dp)