fix(qdreader): harden cron trigger detection

This commit is contained in:
2026-05-22 21:14:36 +08:00
parent aae3fc2ba2
commit a7792012a1
4 changed files with 66 additions and 36 deletions
+2
View File
@@ -103,6 +103,8 @@ Python 示例:
- `rule` 支持正则,可写多行表示多个触发规则。
- `cron` 支持 5 位或 6 位 cron 表达式。
- 定时入口必须按运行环境判断,而不是只靠“消息内容为空”。推荐先检测 `ImType()` / `GetImType()` 是否为 `cron`,命中后直接走定时分支;不要在主入口用 `input()` 兜底读取命令内容。`input()` 是交互等待函数,定时场景可能返回 `q`、阻塞或把空触发误判成普通命令,导致 cron 已触发但业务没跑。参考茅台插件模式:`ImType() === "cron" ? "fake" : ImType()` 后显式进入 `cronTask()`
- cron 头注兼容性优先使用带空格格式 `// [cron: 1 7 * * *]`,避免不同 Autman 解析器只识别一种注释风格。
- `admin: true` 表示仅管理员可执行。
- `priority` 数字越大优先级越高。
- `bypass: true` 常用于全拦截规则,例如 `[rule: ?]`,表示旁路并行处理。