diff --git a/src/plugins/chat/utils.py b/src/plugins/chat/utils.py index 7a155cce5..4eae47263 100644 --- a/src/plugins/chat/utils.py +++ b/src/plugins/chat/utils.py @@ -42,9 +42,9 @@ def is_mentioned_bot_in_message(message: MessageRecv) -> bool: """检查消息是否提到了机器人""" keywords = [global_config.BOT_NICKNAME] nicknames = global_config.BOT_ALIAS_NAMES - if f"回复{global_config.BOT_NICKNAME}({global_config.BOT_QQ})的消息,说: " in message.processed_plain_text: + if re.match(f"回复[\s\S]*?\({global_config.BOT_QQ}\)的消息,说:", message.processed_plain_text): return True - message_content = re.sub(r'\@[\s\S]*?\((\d+)\)','', message.processed_plain_text) + message_content = re.sub(r'\@[\s\S]*?((\d+))','', message.processed_plain_text) message_content = re.sub(r'回复[\s\S]*?\((\d+)\)的消息,说: ','', message_content) for keyword in keywords: if keyword in message_content: diff --git a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py index 164117b96..113d6a1c7 100644 --- a/src/plugins/chat_module/reasoning_chat/reasoning_chat.py +++ b/src/plugins/chat_module/reasoning_chat/reasoning_chat.py @@ -190,7 +190,7 @@ class ReasoningChat: reply_probability = 0 is_at = False is_mentioned = False - if f"@{global_config.BOT_NICKNAME}(id:{global_config.BOT_QQ})" in message.processed_plain_text: + if re.match(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): is_at = True is_mentioned = True diff --git a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py index de523f32a..da15ce28f 100644 --- a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py +++ b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py @@ -215,7 +215,7 @@ class ThinkFlowChat: reply_probability = 0 is_at = False is_mentioned = False - if f"@{global_config.BOT_NICKNAME}(id:{global_config.BOT_QQ})" in message.processed_plain_text: + if re.match(f"@[\s\S]*?(id:{global_config.BOT_QQ})", message.processed_plain_text): is_at = True is_mentioned = True