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

Method handleListRules

autodelcmd/autodelcmd.ts:815–843  ·  view source on GitHub ↗
(msg: Api.Message)

Source from the content-addressed store, hash-verified

813
814 let text = "📋 <b>自动删除规则列表</b>\n\n";
815
816 if (allRules.length === 0) {
817 text += "暂无配置规则\n\n";
818 text += `💡 使用 <code>${mainPrefix}autodelcmd add [命令] [延迟秒数]</code> 添加规则`;
819 await msg.edit({ text, parseMode: "html" });
820 return;
821 }
822
823 text += "⚙️ <b>配置规则:</b>\n";
824 allRules.forEach((rule, index) => {
825 const params = rule.parameters?.length ? ` [${rule.parameters.map((value) => htmlEscape(value)).join(', ')}]` : '';
826 const response = rule.deleteResponse ? ' 🔄' : '';
827 const exact = rule.exactMatch ? ' 🎯' : '';
828 const ruleId = htmlEscape(rule.id || 'unknown');
829 text += `${index + 1}. <code>${htmlEscape(rule.command)}${params}</code> → ${rule.delay}秒${response}${exact} <code>[ID: ${ruleId}]</code>\n`;
830 });
831
832 // 添加图标说明
833 text += `\n<b>📖 图标说明:</b>\n`;
834 text += `• 🔄 = 同时删除响应消息\n`;
835 text += `• 🎯 = 精确匹配(只匹配无参数调用)\n\n`;
836 text += `💡 使用 <code>${mainPrefix}autodelcmd del [ID]</code> 删除规则`;
837
838 await msg.edit({ text, parseMode: "html" });
839 }
840
841 private async handleAddRule(msg: Api.Message, args: string[]) {
842 if (args.length < 2) {
843 await msg.edit({
844 text: `❌ 参数不足\n用法: <code>${mainPrefix}autodelcmd add [命令] [延迟秒数] [参数...] [-r] [-e]</code>\n\n` +
845 `示例:\n` +
846 `• <code>${mainPrefix}autodelcmd add ping 30</code> - ping命令30秒删除(包含带参数的)\n` +

Callers 1

AutoDeletePluginClass · 0.95

Calls 3

getAllRulesMethod · 0.80
htmlEscapeFunction · 0.70
editMethod · 0.45

Tested by

no test coverage detected