From d94b7022e2443477808c9f150777cc3db10360b9 Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Thu, 29 May 2025 13:52:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8F=90=E5=8F=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/utils/utils.py | 11 +++++++++++ template/bot_config_template.toml | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/chat/utils/utils.py b/src/chat/utils/utils.py index c7a45675e..1e60521e6 100644 --- a/src/chat/utils/utils.py +++ b/src/chat/utils/utils.py @@ -62,10 +62,21 @@ def is_mentioned_bot_in_message(message: MessageRecv) -> tuple[bool, float]: f"消息中包含不合理的设置 is_mentioned: {message.message_info.additional_config.get('is_mentioned')}" ) + if global_config.bot.nickname in message.processed_plain_text: + is_mentioned = True + + for alias_name in global_config.bot.alias_names: + if alias_name in message.processed_plain_text: + is_mentioned = True + # 判断是否被@ if re.search(rf"@<(.+?):{global_config.bot.qq_account}>", message.processed_plain_text): is_at = True is_mentioned = True + + # print(f"message.processed_plain_text: {message.processed_plain_text}") + # print(f"is_mentioned: {is_mentioned}") + # print(f"is_at: {is_at}") if is_at and global_config.normal_chat.at_bot_inevitable_reply: reply_probability = 1.0 diff --git a/template/bot_config_template.toml b/template/bot_config_template.toml index 6c89684c2..100e0c6d8 100644 --- a/template/bot_config_template.toml +++ b/template/bot_config_template.toml @@ -13,9 +13,9 @@ version = "2.6.0" #----以上是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读---- [bot] -qq_account = 1145141919810 -nickname = "麦麦" -alias_names = ["麦叠", "牢麦"] +qq_account = 1145141919810 # 麦麦的QQ账号 +nickname = "麦麦" # 麦麦的昵称 +alias_names = ["麦叠", "牢麦"] # 麦麦的别名 [personality] personality_core = "是一个积极向上的女大学生" # 建议50字以内 @@ -84,8 +84,8 @@ response_willing_amplifier = 1 # 麦麦回复意愿放大系数,一般为1 response_interested_rate_amplifier = 1 # 麦麦回复兴趣度放大系数,听到记忆里的内容时放大系数 emoji_response_penalty = 0 # 表情包回复惩罚系数,设为0为不回复单个表情包,减少单独回复表情包的概率 -mentioned_bot_inevitable_reply = false # 提及 bot 必然回复 -at_bot_inevitable_reply = false # @bot 必然回复 +mentioned_bot_inevitable_reply = true # 提及 bot 必然回复 +at_bot_inevitable_reply = true # @bot 必然回复 down_frequency_rate = 3 # 降低回复频率的群组回复意愿降低系数 除法 talk_frequency_down_groups = [] #降低回复频率的群号码