import logging from aiogram import Bot from app.config import get_settings log = logging.getLogger(__name__) async def safe_send(bot: Bot, chat_id: int, text: str, reply_markup=None) -> bool: try: await bot.send_message(chat_id, text, reply_markup=reply_markup) return True except Exception as exc: log.info("Could not message %s: %r", chat_id, exc) return False async def notify_admins(bot: Bot, text: str, reply_markup=None) -> None: for admin_id in get_settings().admin_id_set: await safe_send(bot, admin_id, text[:4000], reply_markup=reply_markup)