Update Telegram bot implementation.

This commit is contained in:
2026-01-18 06:44:58 +08:00
parent 930cd203ee
commit 49cb2430c8

View File

@@ -319,23 +319,43 @@ class ProvisionerBot:
await update.message.reply_text("📭 team.json 中没有账号")
return
# 加载 tracker 以获取成员账号完成状态
tracker = load_team_tracker()
tracker_teams = tracker.get("teams", {})
lines = [f"<b>📋 team.json 账号列表 (共 {len(TEAMS)} 个)</b>\n"]
total_completed = 0
total_accounts = 0
for i, team in enumerate(TEAMS):
email = team.get("owner_email", "")
team_name = team.get("name", "")
has_token = "🔑" if team.get("auth_token") else "🔒"
authorized = "" if team.get("authorized") else ""
needs_login = " [需登录]" if team.get("needs_login") else ""
lines.append(f"{i}. {has_token} {email}{authorized}{needs_login}")
# 从 tracker 获取该 Team 的成员完成情况
team_accounts = tracker_teams.get(team_name, [])
completed_count = sum(1 for acc in team_accounts if acc.get("status") == "completed")
account_count = len(team_accounts)
total_completed += completed_count
total_accounts += account_count
# 显示完成进度
if account_count > 0:
progress = f" [{completed_count}/{account_count}]"
else:
progress = ""
lines.append(f"{i}. {has_token} {email}{progress}{needs_login}")
# 统计
with_token = sum(1 for t in TEAMS if t.get("auth_token"))
authorized = sum(1 for t in TEAMS if t.get("authorized"))
lines.append(f"\n<b>📊 统计:</b>")
lines.append(f"有 Token: {with_token}/{len(TEAMS)}")
lines.append(f"授权: {authorized}/{len(TEAMS)}")
lines.append(f"完成: {total_completed}/{total_accounts}")
# 消息太长时分段发送
text = "\n".join(lines)