feat: Update Telegram bot implementation and its main execution script.
This commit is contained in:
@@ -709,6 +709,13 @@ class ProvisionerBot:
|
||||
team_name = TEAMS[team_idx].get("name", f"Team{team_idx}")
|
||||
self.current_team = team_name
|
||||
|
||||
# 重置停止标志,确保新任务可以正常运行
|
||||
try:
|
||||
import run
|
||||
run._shutdown_requested = False
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
await update.message.reply_text(f"🚀 开始处理 Team {team_idx}: {team_name}...")
|
||||
|
||||
# 在后台线程执行任务
|
||||
@@ -732,6 +739,14 @@ class ProvisionerBot:
|
||||
return
|
||||
|
||||
self.current_team = "全部"
|
||||
|
||||
# 重置停止标志,确保新任务可以正常运行
|
||||
try:
|
||||
import run
|
||||
run._shutdown_requested = False
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
await update.message.reply_text(f"🚀 开始处理所有 Team (共 {len(TEAMS)} 个)...")
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
@@ -781,6 +796,13 @@ class ProvisionerBot:
|
||||
# 启动任务 (run_all_teams 会自动处理未完成的账号)
|
||||
self.current_team = "继续处理"
|
||||
|
||||
# 重置停止标志,确保新任务可以正常运行
|
||||
try:
|
||||
import run
|
||||
run._shutdown_requested = False
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
loop = asyncio.get_event_loop()
|
||||
self.current_task = loop.run_in_executor(
|
||||
self.executor,
|
||||
@@ -805,12 +827,9 @@ class ProvisionerBot:
|
||||
self.current_team = None
|
||||
# 清理进度跟踪
|
||||
progress_finish()
|
||||
# 重置停止标志,以便下次任务可以正常运行
|
||||
try:
|
||||
import run
|
||||
run._shutdown_requested = False
|
||||
except Exception:
|
||||
pass
|
||||
# 注意: 不在这里重置 _shutdown_requested
|
||||
# 让标志保持 True,直到下次任务启动时再重置
|
||||
# 这样可以确保线程池中的任务能够正确检测到停止信号
|
||||
|
||||
def _run_team_task(self, team_idx: int):
|
||||
"""执行单个 Team 任务 (在线程池中运行)"""
|
||||
|
||||
Reference in New Issue
Block a user