MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / buildListText

Function buildListText

bs/bs.ts:533–561  ·  view source on GitHub ↗
(targets: TargetRecord[], mode: BsMode)

Source from the content-addressed store, hash-verified

531}
532
533function 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
563async function collectMessages(
564 client: any,

Callers 1

BsPluginClass · 0.85

Calls 2

formatModeFunction · 0.85
renderTargetFunction · 0.85

Tested by

no test coverage detected