Merge pull request #864 from RockChinQ/version/3.3.0.2

fix: 消息忽略规则失效 (#854)
This commit is contained in:
Junyan Qin 2024-08-01 23:12:33 +08:00 committed by GitHub
commit f1ff9c05c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,8 @@
from __future__ import annotations
import mirai
import mirai.models
import mirai.models.message
from ...core import app
@ -63,6 +65,7 @@ class ContentFilterStage(stage.PipelineStage):
"""请求llm前处理消息
只要有一个不通过就不放行只放行 PASS 的消息
"""
if not self.ap.pipeline_cfg.data['income-msg-check']:
return entities.StageProcessResult(
result_type=entities.ResultType.CONTINUE,
@ -145,8 +148,10 @@ class ContentFilterStage(stage.PipelineStage):
contain_non_text = False
text_components = [mirai.Plain, mirai.models.message.Source]
for me in query.message_chain:
if not isinstance(me, mirai.Plain):
if type(me) not in text_components:
contain_non_text = True
break