Powerman9x commited on
Commit
6df5d31
·
verified ·
1 Parent(s): aa686b7

Upload sync_hf.py

Browse files
Files changed (1) hide show
  1. scripts/sync_hf.py +12 -0
scripts/sync_hf.py CHANGED
@@ -1381,6 +1381,18 @@ class OpenClawFullSync:
1381
  if TELEGRAM_API_BASE:
1382
  tg_ch["apiRoot"] = TELEGRAM_API_BASE.rstrip("/")
1383
  print(f"[SYNC] Set channels.telegram.apiRoot = {tg_ch['apiRoot']}")
 
 
 
 
 
 
 
 
 
 
 
 
1384
  print("[SYNC] Set channels.telegram: dmPolicy=open, allowFrom=[*]")
1385
 
1386
  removed_keys = _strip_retired_tier_eval_keys(data)
 
1381
  if TELEGRAM_API_BASE:
1382
  tg_ch["apiRoot"] = TELEGRAM_API_BASE.rstrip("/")
1383
  print(f"[SYNC] Set channels.telegram.apiRoot = {tg_ch['apiRoot']}")
1384
+ # Keep the bot token aligned with the TELEGRAM_BOT_TOKEN secret —
1385
+ # a regenerated BotFather token otherwise leaves a stale config
1386
+ # token forever (every API call 404s). Secret = source of truth.
1387
+ _tg_token = (os.environ.get("TELEGRAM_BOT_TOKEN") or "").strip()
1388
+ if _tg_token:
1389
+ if tg_ch.get("botToken") != _tg_token:
1390
+ tg_ch["botToken"] = _tg_token
1391
+ print("[SYNC] Set channels.telegram.botToken from TELEGRAM_BOT_TOKEN secret")
1392
+ else:
1393
+ print("[SYNC] channels.telegram.botToken already matches secret")
1394
+ else:
1395
+ print("[SYNC] TELEGRAM_BOT_TOKEN not set — leaving botToken unchanged")
1396
  print("[SYNC] Set channels.telegram: dmPolicy=open, allowFrom=[*]")
1397
 
1398
  removed_keys = _strip_retired_tier_eval_keys(data)