feat(telegram_bot): Auto-reload config after account import to sync memory state

- Add automatic config reload after importing accounts to team.json
- Prevent save_team_json() from overwriting newly imported data by syncing memory state
- Update user feedback message to indicate config is auto-refreshed instead of requiring manual /reload command
- Improve user experience by eliminating extra step after account import
This commit is contained in:
2026-01-18 17:45:21 +08:00
parent 95fa705768
commit 5de0a1a053

View File

@@ -1398,13 +1398,16 @@ class ProvisionerBot:
file_status = "📄 已创建 team.json" if is_new_file else "📄 已更新 team.json" file_status = "📄 已创建 team.json" if is_new_file else "📄 已更新 team.json"
# 自动重载配置,同步内存状态,避免 save_team_json() 覆盖新导入的数据
reload_result = reload_config()
await update.message.reply_text( await update.message.reply_text(
f"<b>✅ 导入完成</b>\n\n" f"<b>✅ 导入完成</b>\n\n"
f"{file_status}\n" f"{file_status}\n"
f"新增: {added}\n" f"新增: {added}\n"
f"跳过 (重复): {skipped}\n" f"跳过 (重复): {skipped}\n"
f"team.json 总数: {len(existing_accounts)}\n\n" f"team.json 总数: {len(existing_accounts)}\n\n"
f"💡 使用 /reload 刷新配置\n" f"✅ 配置已自动刷新\n"
f"使用 /run_all 或 /run &lt;n&gt; 开始处理", f"使用 /run_all 或 /run &lt;n&gt; 开始处理",
parse_mode="HTML" parse_mode="HTML"
) )