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] # 以下是消息过滤,可以根据规则过滤特定消息,将不会读取这些消息