feat(chat): 在群组静默列表中忽略图片和表情包

原有的群组静默功能只对非@的文本消息生效,导致在静默群组中发送的图片和表情包依然会被消息管理器处理。

本次更新将静默逻辑扩展,现在也会忽略图片和表情包类型的消息,从而更彻底地实现群组消息的静默,减少不必要的资源消耗。
This commit is contained in:
tt-P607
2025-10-23 01:16:24 +08:00
parent e0c896920b
commit c149620fd0

View File

@@ -699,8 +699,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: