From 054f927c057d5f5d68284ec1b6ce89c22e301850 Mon Sep 17 00:00:00 2001 From: zhayujie Date: Fri, 1 Sep 2023 13:45:04 +0800 Subject: [PATCH] fix: at_list bug in wechat channel --- channel/chat_channel.py | 7 ++++--- config-template.json | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/channel/chat_channel.py b/channel/chat_channel.py index 33b3d7f..f3a6482 100644 --- a/channel/chat_channel.py +++ b/channel/chat_channel.py @@ -109,9 +109,10 @@ class ChatChannel(Channel): flag = True pattern = f"@{re.escape(self.name)}(\u2005|\u0020)" subtract_res = re.sub(pattern, r"", content) - for at in context["msg"].at_list: - pattern = f"@{re.escape(at)}(\u2005|\u0020)" - subtract_res = re.sub(pattern, r"", subtract_res) + if isinstance(context["msg"].at_list, list): + for at in context["msg"].at_list: + pattern = f"@{re.escape(at)}(\u2005|\u0020)" + subtract_res = re.sub(pattern, r"", subtract_res) if subtract_res == content and context["msg"].self_display_name: # 前缀移除后没有变化,使用群昵称再次移除 pattern = f"@{re.escape(context['msg'].self_display_name)}(\u2005|\u0020)" diff --git a/config-template.json b/config-template.json index f995c53..f01633d 100644 --- a/config-template.json +++ b/config-template.json @@ -4,7 +4,6 @@ "channel_type": "wx", "proxy": "", "hot_reload": false, - "claude_api_cookie": "", "single_chat_prefix": [ "bot", "@bot"