fix push notification
This commit is contained in:
parent
8a813be5cc
commit
54b263f20c
1 changed files with 30 additions and 0 deletions
|
|
@ -336,6 +336,21 @@ class LichessBot:
|
||||||
if len(user_gamers) == 1:
|
if len(user_gamers) == 1:
|
||||||
self.db.set_user_active_gamer(user_id, gamer_id)
|
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)
|
# Notify admin bot about new player (always notify on link)
|
||||||
try:
|
try:
|
||||||
user_obj = update.effective_user
|
user_obj = update.effective_user
|
||||||
|
|
@ -406,6 +421,21 @@ class LichessBot:
|
||||||
if len(user_gamers) == 1:
|
if len(user_gamers) == 1:
|
||||||
self.db.set_user_active_gamer(user_id, gamer_id)
|
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)
|
# Notify admin bot about player link (always notify)
|
||||||
try:
|
try:
|
||||||
user_obj = update.effective_user
|
user_obj = update.effective_user
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue