fix push notification

This commit is contained in:
vrubelroman 2025-11-18 14:41:13 +03:00
parent 8a813be5cc
commit 54b263f20c

View file

@ -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