From 54b263f20c2abfa80f692a8cb37a249515c6cff1 Mon Sep 17 00:00:00 2001 From: vrubelroman Date: Tue, 18 Nov 2025 14:41:13 +0300 Subject: [PATCH] fix push notification --- LichessClientTG_bot/bot.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/LichessClientTG_bot/bot.py b/LichessClientTG_bot/bot.py index 76f53b1..8b5870d 100644 --- a/LichessClientTG_bot/bot.py +++ b/LichessClientTG_bot/bot.py @@ -336,6 +336,21 @@ class LichessBot: if len(user_gamers) == 1: self.db.set_user_active_gamer(user_id, gamer_id) + # Start periodic task for this gamer (60 minutes period) + try: + gamer_data = { + 'id': gamer_id, + 'username': username, + 'token': token, + 'period_minutes': 60 + } + await self.start_periodic_task(gamer_data, user_id, 60) + logger.info(f"Started periodic task for {username} (user {user_id}) with period 60 minutes") + except Exception as e: + logger.error(f"Failed to start periodic task for {username}: {e}") + import traceback + logger.error(traceback.format_exc()) + # Notify admin bot about new player (always notify on link) try: user_obj = update.effective_user @@ -406,6 +421,21 @@ class LichessBot: if len(user_gamers) == 1: self.db.set_user_active_gamer(user_id, gamer_id) + # Start periodic task for this gamer (60 minutes period) + try: + gamer_data = { + 'id': gamer_id, + 'username': username, + 'token': None, + 'period_minutes': 60 + } + await self.start_periodic_task(gamer_data, user_id, 60) + logger.info(f"Started periodic task for {username} (user {user_id}) with period 60 minutes") + except Exception as e: + logger.error(f"Failed to start periodic task for {username}: {e}") + import traceback + logger.error(traceback.format_exc()) + # Notify admin bot about player link (always notify) try: user_obj = update.effective_user