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

Class AcronPlugin

acron/acron.ts:545–1297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

543`;
544
545class AcronPlugin extends Plugin {
546
547 description: string = `定时发送/转发/复制/置顶/取消置顶/删除消息/执行命令\n\n${help_text}`;
548 cmdHandlers: Record<
549 string,
550 (msg: Api.Message, trigger?: Api.Message) => Promise<void>
551 > = {
552 acron: async (msg: Api.Message) => {
553 const lines = msg.message?.trim()?.split(/\r?\n/g) || [];
554
555 const parts = lines?.[0]?.split(/\s+/) || [];
556
557 const [, ...args] = parts; // 跳过命令本身
558 const sub = (args[0] || "").toLowerCase();
559
560 try {
561 if (!sub) {
562 await msg.edit({
563 text: help_text,
564 parseMode: "html",
565 });
566 return;
567 }
568
569 if (sub === "list" || sub === "ls" || sub === "la") {
570 let p1 = (args[1] || "").toLowerCase();
571 let p2 = (args[2] || "").toLowerCase();
572 if (sub === "la") {
573 p2 = p1;
574 p1 = "all";
575 }
576
577 const scopeAll = p1 === "all";
578 const maybeType = (scopeAll ? p2 : p1) as AcronType | "";
579 const typeFilter: AcronType | undefined = [
580 "send",
581 "cmd",
582 "copy",
583 "forward",
584 "del",
585 "del_re",
586 "pin",
587 "unpin",
588 ].includes(maybeType as any)
589 ? (maybeType as AcronType)
590 : undefined;
591
592 const typeLabel = (tp?: AcronType) =>
593 tp === "send"
594 ? "发送"
595 : tp === "cmd"
596 ? "命令"
597 : tp === "copy"
598 ? "复制"
599 : tp === "forward"
600 ? "转发"
601 : tp === "del"
602 ? "删除"

Callers

nothing calls this directly

Calls 12

parseCronFromArgsFunction · 0.85
writeMethod · 0.80
getDBFunction · 0.70
formatEntityFunction · 0.70
formatDateFunction · 0.70
buildCopyCommandFunction · 0.70
makeCronKeyFunction · 0.70
scheduleTaskFunction · 0.70
toIntFunction · 0.70
getRemarkFromMsgFunction · 0.70
tryParseRegexFunction · 0.70
editMethod · 0.45

Tested by

no test coverage detected