This commit is contained in:
2026-01-18 01:57:11 +08:00
parent ad120687b3
commit c39a01c4c0
3 changed files with 60 additions and 13 deletions

View File

@@ -255,18 +255,37 @@ class BotNotifier:
"""通知任务开始"""
await self.notify(f"<b>🚀 任务开始</b>\nTeam: {team_name}")
async def notify_task_completed(self, team_name: str, success: int, failed: int):
"""通知任务完成"""
async def notify_task_completed(self, team_name: str, success_accounts: list, failed_accounts: list):
"""通知任务完成
Args:
team_name: Team 名称
success_accounts: 成功的账号列表
failed_accounts: 失败的账号列表
"""
if not TELEGRAM_NOTIFY_ON_COMPLETE:
return
status = "全部成功" if failed == 0 else f"{failed} 个失败"
await self.notify(
success_count = len(success_accounts)
failed_count = len(failed_accounts)
status = "全部成功" if failed_count == 0 else f"{failed_count} 个失败"
# 构建消息
message = (
f"<b>✅ 任务完成</b>\n"
f"Team: {team_name}\n"
f"成功: {success}\n"
f"成功: {success_count}\n"
f"状态: {status}"
)
# 如果有成功的账号,列出来
if success_accounts:
message += "\n\n<b>成功账号:</b>"
for email in success_accounts:
message += f"\n• <code>{email}</code>"
await self.notify(message)
async def notify_error(self, message: str, details: str = ""):
"""通知错误"""
if not TELEGRAM_NOTIFY_ON_ERROR: