From 8e04bf36b4683b116c55a3c5362e6ee09f387044 Mon Sep 17 00:00:00 2001 From: Windpicker-owo <3431391539@qq.com> Date: Thu, 13 Nov 2025 16:22:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(config):=20=E6=B7=BB=E5=8A=A0=E8=A1=A8?= =?UTF-8?q?=E6=83=85=E5=8C=85=E5=9B=9E=E5=A4=8D=E9=85=8D=E7=BD=AE=EF=BC=8C?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E6=88=96=E7=A6=81=E6=AD=A2=E5=9B=9E=E5=A4=8D?= =?UTF-8?q?=E8=A1=A8=E6=83=85=E5=8C=85=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/planner_actions/action_manager.py | 7 +++++++ src/config/official_configs.py | 2 ++ template/bot_config_template.toml | 4 +++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/chat/planner_actions/action_manager.py b/src/chat/planner_actions/action_manager.py index cb235c03e..0c83314c5 100644 --- a/src/chat/planner_actions/action_manager.py +++ b/src/chat/planner_actions/action_manager.py @@ -241,6 +241,13 @@ class ChatterActionManager: "command": command, } else: + # 检查目标消息是否为表情包消息以及配置是否允许回复表情包 + if target_message and getattr(target_message, 'is_emoji', False): + # 如果是表情包消息且配置不允许回复表情包,则跳过回复 + if not getattr(global_config.chat, 'allow_reply_to_emoji', True): + logger.info(f"{log_prefix} 目标消息为表情包且配置不允许回复表情包,跳过回复") + return {"action_type": action_name, "success": True, "reply_text": "", "skip_reason": "emoji_not_allowed"} + # 生成回复 (reply 或 respond) # reply: 针对单条消息的回复,使用 s4u 模板 # respond: 对未读消息的统一回应,使用 normal 模板 diff --git a/src/config/official_configs.py b/src/config/official_configs.py index 0f8d7da68..891ad1706 100644 --- a/src/config/official_configs.py +++ b/src/config/official_configs.py @@ -152,6 +152,8 @@ class ChatConfig(ValidatedConfigBase): multiple_replies_strategy: Literal["keep_first", "keep_best", "keep_last"] = Field( default="keep_first", description="多重回复处理策略:keep_first(保留第一个),keep_best(保留最佳),keep_last(保留最后一个)" ) + # 表情包回复配置 + allow_reply_to_emoji: bool = Field(default=True, description="是否允许回复表情包消息") class MessageReceiveConfig(ValidatedConfigBase): diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index f913ecdd6..4257e82e0 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -1,5 +1,5 @@ [inner] -version = "7.6.9" +version = "7.7.0" #----以下是给开发人员阅读的,如果你只是部署了MoFox-Bot,不需要阅读---- #如果你想要修改配置文件,请递增version的值 @@ -165,6 +165,8 @@ decision_history_length = 3 # 决策历史记录的长度,用于增强语言 enable_multiple_replies = false # 是否允许多重回复(True=允许多个回复动作,False=只保留一个回复动作) multiple_replies_strategy = "keep_first" # 多重回复处理策略:keep_first(保留第一个),keep_best(保留最佳),keep_last(保留最后一个) +# 表情包回复配置 +allow_reply_to_emoji = false # 是否允许回复表情包消息 [message_receive] # 以下是消息过滤,可以根据规则过滤特定消息,将不会读取这些消息