Spaces:
Running on Zero
Running on Zero
File size: 611 Bytes
d896946 4e64e70 d896946 4e64e70 d896946 4e64e70 d896946 4e64e70 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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)
|