From c5bd89d6f55562f4559fa73a3bdaaf27ed64f457 Mon Sep 17 00:00:00 2001 From: tt-P607 <68868379+tt-P607@users.noreply.github.com> Date: Thu, 23 Oct 2025 01:16:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(chat):=20=E5=9C=A8=E7=BE=A4=E7=BB=84?= =?UTF-8?q?=E9=9D=99=E9=BB=98=E5=88=97=E8=A1=A8=E4=B8=AD=E5=BF=BD=E7=95=A5?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=92=8C=E8=A1=A8=E6=83=85=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原有的群组静默功能只对非@的文本消息生效,导致在静默群组中发送的图片和表情包依然会被消息管理器处理。 本次更新将静默逻辑扩展,现在也会忽略图片和表情包类型的消息,从而更彻底地实现群组消息的静默,减少不必要的资源消耗。 --- src/chat/message_receive/bot.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/chat/message_receive/bot.py b/src/chat/message_receive/bot.py index b91790f18..4f598dfb7 100644 --- a/src/chat/message_receive/bot.py +++ b/src/chat/message_receive/bot.py @@ -703,8 +703,13 @@ class ChatBot: # 在将消息添加到管理器之前进行最终的静默检查 should_process_in_manager = True if group_info and str(group_info.group_id) in global_config.message_receive.mute_group_list: - if not message.is_mentioned: - logger.debug(f"群组 {group_info.group_id} 在静默列表中,且消息不是@或回复,跳过消息管理器处理") + # 检查消息是否为图片或表情包 + is_image_or_emoji = message.is_picid or message.is_emoji + if not message.is_mentioned and not is_image_or_emoji: + logger.debug(f"群组 {group_info.group_id} 在静默列表中,且消息不是@、回复或图片/表情包,跳过消息管理器处理") + should_process_in_manager = False + elif is_image_or_emoji: + logger.debug(f"群组 {group_info.group_id} 在静默列表中,但消息是图片/表情包,静默处理") should_process_in_manager = False if should_process_in_manager: