add audio notifications

This commit is contained in:
vrubelroman 2025-11-18 19:39:52 +03:00
parent 9cb573db7d
commit 1f384c12ab
2 changed files with 47 additions and 5 deletions

View file

@ -43,7 +43,7 @@ class LichessBot:
self.application = None # Will be set when application is created
self.counters = MessageCounters() # Message counters
async def _notify_admin_new_player(self, player_username: str, added_by_user_id: int, added_by_username: Optional[str]):
async def _notify_admin_new_player(self, player_username: str, added_by_user_id: int, added_by_username: Optional[str], is_new_gamer: bool = False):
"""Notify admin about newly linked player (always try to send)."""
try:
admin_bot = get_admin_bot()
@ -52,7 +52,8 @@ class LichessBot:
await admin_bot.notify_new_player(
player_username=player_username,
added_by_user_id=added_by_user_id,
added_by_username=added_by_username
added_by_username=added_by_username,
is_new_gamer=is_new_gamer
)
return
except Exception as e:
@ -355,7 +356,7 @@ class LichessBot:
try:
user_obj = update.effective_user
await self._notify_admin_new_player(
username, user_id, user_obj.username if user_obj else None
username, user_id, user_obj.username if user_obj else None, is_new_gamer
)
except Exception as e:
logger.error(f"Admin notify failed after adding gamer with token: {e}")
@ -440,7 +441,7 @@ class LichessBot:
try:
user_obj = update.effective_user
await self._notify_admin_new_player(
username, user_id, user_obj.username if user_obj else None
username, user_id, user_obj.username if user_obj else None, is_new_gamer
)
logger.info(f"Admin notification processed for player {username}")
except Exception as e: