From 2ea8b4ef73ffea2048d7f916fe34e4c41f89ad73 Mon Sep 17 00:00:00 2001 From: lanvent Date: Fri, 7 Apr 2023 16:30:38 +0800 Subject: [PATCH] fix: chat when single_chat_prefix is None --- channel/chat_channel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/channel/chat_channel.py b/channel/chat_channel.py index 1fcc619..815b201 100644 --- a/channel/chat_channel.py +++ b/channel/chat_channel.py @@ -97,7 +97,7 @@ class ChatChannel(Channel): logger.info("[WX]receive group voice, but checkprefix didn't match") return None else: # 单聊 - match_prefix = check_prefix(content, conf().get('single_chat_prefix')) + match_prefix = check_prefix(content, conf().get('single_chat_prefix',[''])) if match_prefix is not None: # 判断如果匹配到自定义前缀,则返回过滤掉前缀+空格后的内容 content = content.replace(match_prefix, '', 1).strip() elif context["origin_ctype"] == ContextType.VOICE: # 如果源消息是私聊的语音消息,允许不匹配前缀,放宽条件 @@ -305,6 +305,8 @@ class ChatChannel(Channel): def check_prefix(content, prefix_list): + if not prefix_list: + return None for prefix in prefix_list: if content.startswith(prefix): return prefix