mirror of
https://github.com/Zippland/Bubbles.git
synced 2026-01-19 01:21:15 +08:00
fix(message_forwarder): skip forwarding for quoted messages
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
4
robot.py
4
robot.py
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user