(targets: TargetRecord[], mode: BsMode)
| 531 | } |
| 532 | |
| 533 | function buildListText(targets: TargetRecord[], mode: BsMode): string { |
| 534 | const enabled = targets |
| 535 | .filter((t) => t.status !== "0") |
| 536 | .sort((a, b) => Number(a.id) - Number(b.id)); |
| 537 | const disabled = targets |
| 538 | .filter((t) => t.status === "0") |
| 539 | .sort((a, b) => Number(a.id) - Number(b.id)); |
| 540 | |
| 541 | const lines: string[] = []; |
| 542 | lines.push(`当前模式:<b>${formatMode(mode)}</b>`); |
| 543 | |
| 544 | if (enabled.length > 0) { |
| 545 | lines.push("\n🔛 已启用的目标:"); |
| 546 | lines.push(enabled.map((target) => `- ${renderTarget(target)}`).join("\n")); |
| 547 | } |
| 548 | |
| 549 | if (disabled.length > 0) { |
| 550 | lines.push("\n⏹ 已禁用的目标:"); |
| 551 | lines.push( |
| 552 | disabled.map((target) => `- ${renderTarget(target)}`).join("\n") |
| 553 | ); |
| 554 | } |
| 555 | |
| 556 | if (enabled.length === 0 && disabled.length === 0) { |
| 557 | lines.push("\n暂无目标,请使用 <code>add</code> 命令添加"); |
| 558 | } |
| 559 | |
| 560 | return lines.join("\n"); |
| 561 | } |
| 562 | |
| 563 | async function collectMessages( |
| 564 | client: any, |
no test coverage detected