From b3c8a7d8de3bf51440e1b079155622d7a894dd36 Mon Sep 17 00:00:00 2001 From: zwssunny Date: Mon, 27 Mar 2023 19:58:29 +0800 Subject: [PATCH] =?UTF-8?q?check=5Fprefix=E5=87=BD=E6=95=B0=E8=B7=91?= =?UTF-8?q?=E5=88=B0=E5=A4=96=E9=9D=A2=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- channel/wechat/wechat_channel.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/channel/wechat/wechat_channel.py b/channel/wechat/wechat_channel.py index 06a3381..cb75e94 100644 --- a/channel/wechat/wechat_channel.py +++ b/channel/wechat/wechat_channel.py @@ -290,16 +290,15 @@ class WechatChannel(Channel): context.type = ContextType.TEXT if (context["isgroup"] == True): # 校验关键字 - match_prefix = self.check_prefix(content, conf().get('group_chat_prefix')) \ - or self.check_contain(content, conf().get('group_chat_keyword')) + match_prefix = check_prefix(content, conf().get('group_chat_prefix')) \ + or check_contain(content, conf().get('group_chat_keyword')) # Wechaty判断is_at为True,返回的内容是过滤掉@之后的内容;而is_at为False,则会返回完整的内容 if match_prefix is not None: # 故判断如果匹配到自定义前缀,则返回过滤掉前缀+空格后的内容,用于实现类似自定义+前缀触发生成AI图片的功能 prefixes = conf().get('group_chat_prefix') for prefix in prefixes: if content.startswith(prefix): - content = content.replace( - prefix, '', 1).strip() + content = content.replace(prefix, '', 1).strip() break else: logger.info("[WX]receive voice check prefix: " + 'False')