fix(message_forwarder): skip forwarding for quoted messages

This commit is contained in:
zihanjian
2025-11-18 11:01:12 +08:00
parent ff159b319d
commit b27b75a3be
2 changed files with 5 additions and 0 deletions

View File

@@ -54,6 +54,7 @@ class MessageForwarder:
or not ctx.is_group
or not ctx.msg
or ctx.msg.from_self()
or getattr(ctx, "has_quote_reference", False)
):
return False

View File

@@ -878,6 +878,7 @@ class Robot(Job):
quoted_msg_id = None
quoted_image_extra = None
msg_data = None
# 处理引用消息等特殊情况
if msg.type == 49 and ("<title>" in msg.content or "<appmsg" in msg.content):
# 尝试提取引用消息中的文本
@@ -941,6 +942,9 @@ class Robot(Job):
setattr(ctx, 'quoted_msg_id', quoted_msg_id)
setattr(ctx, 'quoted_image_extra', quoted_image_extra)
# 标记是否引用了其他消息(用于后续逻辑过滤)
setattr(ctx, 'has_quote_reference', bool(msg_data and msg_data.get("has_quote")))
# 获取发送者昵称
ctx.sender_name = ctx.get_sender_alias_or_name()