From 204744cd7121cb4b7528739cea69355e4519564b Mon Sep 17 00:00:00 2001 From: ChangingSelf Date: Tue, 11 Mar 2025 00:12:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E5=90=8D?= =?UTF-8?q?=E4=B8=8E=E4=BF=AE=E6=94=B9=E8=BF=87=E6=BB=A4=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E4=B8=BAraw=5Fmessage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat/bot.py | 4 ++-- src/plugins/chat/config.py | 4 ++-- template/bot_config_template.toml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/chat/bot.py b/src/plugins/chat/bot.py index c72ff2380..18652cfd4 100644 --- a/src/plugins/chat/bot.py +++ b/src/plugins/chat/bot.py @@ -77,10 +77,10 @@ class ChatBot: return # 正则表达式过滤 - for pattern in global_config.ban_words_regex: + for pattern in global_config.ban_msgs_regex: if re.search(pattern, message.detailed_plain_text): logger.info( - f"[{message.group_name}]{message.user_nickname}:{message.processed_plain_text}") + f"[{message.group_name}]{message.user_nickname}:{message.raw_message}") logger.info(f"[正则表达式过滤]消息匹配到{pattern},filtered") return diff --git a/src/plugins/chat/config.py b/src/plugins/chat/config.py index 7a7e4ebc9..888e33a7f 100644 --- a/src/plugins/chat/config.py +++ b/src/plugins/chat/config.py @@ -43,7 +43,7 @@ class BotConfig: EMOJI_CHECK_PROMPT: str = "符合公序良俗" # 表情包过滤要求 ban_words = set() - ban_words_regex = set() + ban_msgs_regex = set() max_response_length: int = 1024 # 最大回复长度 @@ -280,7 +280,7 @@ class BotConfig: config.down_frequency_rate = msg_config.get("down_frequency_rate", config.down_frequency_rate) if config.INNER_VERSION in SpecifierSet(">=0.0.5"): - config.ban_words_regex = msg_config.get("ban_words_regex", config.ban_words_regex) + config.ban_msgs_regex = msg_config.get("ban_msgs_regex", config.ban_msgs_regex) def memory(parent: dict): memory_config = parent["memory"] diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 44c80fd2f..7dc15eb27 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -40,8 +40,8 @@ ban_words = [ # "403","张三" ] -ban_words_regex = [ - # 需要过滤的消息匹配的正则表达式,匹配到的消息将被过滤,若不了解正则表达式请勿修改 +ban_msgs_regex = [ + # 需要过滤的消息(原始消息)匹配的正则表达式,匹配到的消息将被过滤,若不了解正则表达式请勿修改 #"https?://[^\\s]+", # 匹配https链接 #"\\d{4}-\\d{2}-\\d{2}", # 匹配日期 ]