From a3e2604a1c4f3274e1fe77f8e1430ef574c398ef Mon Sep 17 00:00:00 2001 From: Bakadax Date: Sun, 6 Apr 2025 14:57:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat/utils.py | 4 ++-- src/plugins/chat_module/reasoning_chat/reasoning_chat.py | 2 +- src/plugins/chat_module/think_flow_chat/think_flow_chat.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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