From 4e5e33b9fc72d2538ab9d00f83be7919af73886d Mon Sep 17 00:00:00 2001 From: "Mr.Xia" <1424473282@qq.com> Date: Sun, 30 Aug 2026 10:37:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(chatai):=20matcher=20=E9=99=90=E5=AE=9A=20*?= =?UTF-8?q?=20=E5=89=8D=E7=BC=80=E8=A7=84=E5=88=99,=E9=81=BF=E5=85=8D=20bl?= =?UTF-8?q?ock=20=E5=90=9E=E6=8E=89=20wtfllm=20=E7=AD=89=E4=BD=8E=E4=BC=98?= =?UTF-8?q?=E5=85=88=E7=BA=A7=E6=8F=92=E4=BB=B6=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- danding_bot/plugins/chatai/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/danding_bot/plugins/chatai/__init__.py b/danding_bot/plugins/chatai/__init__.py index 3f63cfc..97aa458 100644 --- a/danding_bot/plugins/chatai/__init__.py +++ b/danding_bot/plugins/chatai/__init__.py @@ -34,7 +34,13 @@ _ai_client: OpenAI | None = None _recall_tasks: set[asyncio.Task] = set() # 注册消息事件处理器 -message_handler = on_message(priority=50, block=True) +# 只匹配 "*" 前缀消息:block=True 会拦截更低优先级的 matcher(如 wtfllm), +# 若不限定规则,全量消息都会被本插件吞掉,导致其他插件无法响应。 +def _is_ai_prefix(event) -> bool: + return event.get_plaintext().strip().startswith("*") + + +message_handler = on_message(rule=_is_ai_prefix, priority=50, block=True) # 确保输出目录存在 os.makedirs("data/chatai", exist_ok=True)