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

Class AutoDeletePlugin

autodelcmd/autodelcmd.ts:706–1176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

704 constructor() {
705 super();
706 this.initializeOnStartup();
707 }
708
709 private async initializeOnStartup() {
710 try {
711 console.log("[autodelcmd] 插件启动,开始初始化...");
712 const initialized = await ensureServiceInitialized();
713 if (initialized) {
714 console.log("[autodelcmd] 插件启动初始化成功");
715 } else {
716 console.log("[autodelcmd] 插件启动初始化失败,将在首次使用时重试");
717 }
718 } catch (error) {
719 console.error("[autodelcmd] 插件启动初始化出错:", error);
720 }
721 }
722
723 description: string = `🗑️ 自动删除命令消息插件
724
725<b>功能说明:</b>
726- 自动监听并延迟删除特定命令的消息
727- 支持所有配置的自定义前缀和别名命令
728- 支持自定义删除规则和延迟时间
729- 首次运行自动创建配置文件,包含预设的默认规则
730
731<b>消息处理范围:</b>
732- 自己发出的所有命令消息
733- Saved Messages(收藏夹)中的命令消息
734
735<b>配置管理命令:</b>
736• <code>${mainPrefix}autodelcmd on/off</code> - 启用/禁用自动删除功能
737• <code>${mainPrefix}autodelcmd status</code> - 查看功能状态和规则统计
738• <code>${mainPrefix}autodelcmd list</code> - 查看所有规则
739• <code>${mainPrefix}autodelcmd add [命令] [延迟秒数] [参数1] [参数2] [...] [-r] [-e]</code> - 添加规则
740• <code>${mainPrefix}autodelcmd del [规则ID或命令名]</code> - 删除规则或查看规则
741• <code>${mainPrefix}autodelcmd reset</code> - 重置为默认配置
742
743<b>特殊选项:</b>
744• 🔄 使用 <code>-r</code> 或 <code>--response</code> 参数启用删除响应消息
745• 删除响应指同时删除命令触发的最近一条回复消息
746• 🎯 使用 <code>-e</code> 或 <code>--exact</code> 参数启用精确匹配模式
747• 精确匹配只匹配无参数的命令调用,不匹配带参数的调用
748
749<b>使用示例:</b>
750• <code>${mainPrefix}autodelcmd list</code> - 查看所有配置规则
751• <code>${mainPrefix}autodelcmd add ping 30</code> - ping命令30秒后删除
752• <code>${mainPrefix}autodelcmd add speedtest 60 -r</code> - speedtest命令60秒后删除(🔄包含响应)
753• <code>${mainPrefix}autodelcmd add tpm 60 list ls search</code> - tpm list/ls/search任一命令60秒后删除
754• <code>${mainPrefix}autodelcmd add ping 30 -e</code> - 只有无参数的ping命令30秒后删除
755• <code>${mainPrefix}autodelcmd del ping</code> - 查看ping命令的所有规则
756• <code>${mainPrefix}autodelcmd del 1</code> - 使用ID删除指定规则
757• <code>${mainPrefix}autodelcmd reset</code> - 重置为默认配置
758
759<b>配置文件位置:</b>
760配置文件保存在 <code>assets/autodelcmd/config.json</code>,可直接编辑修改规则。
761
762<b>注意:</b> 插件默认处于禁用状态,需要手动启用才能工作。首次运行会自动创建配置文件并写入默认规则。`;
763

Callers

nothing calls this directly

Calls 13

handleStatusMethod · 0.95
handleEnableMethod · 0.95
handleDisableMethod · 0.95
handleListRulesMethod · 0.95
handleAddRuleMethod · 0.95
handleRemoveRuleMethod · 0.95
handleResetMethod · 0.95
shouldProcessMessageMethod · 0.95
ensureServiceInitializedFunction · 0.85
errorMethod · 0.80
editMethod · 0.45

Tested by

no test coverage detected