From 955b859f2c587a66de80dc7758577b46907f921a Mon Sep 17 00:00:00 2001 From: Dong_master <2213070223@qq.com> Date: Tue, 18 Mar 2025 23:14:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A4=84=E7=90=86at=E5=85=A8=E5=91=98?= =?UTF-8?q?=E7=9A=84atall,=E4=BB=A5=E5=8F=8A=E4=BF=AE=E5=A4=8D=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E5=85=AC=E4=BC=97=E5=8F=B7=E5=92=8C=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=9B=A2=E9=98=9F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/platform/sources/gewechat.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/platform/sources/gewechat.py b/pkg/platform/sources/gewechat.py index 93af73bc..870081ea 100644 --- a/pkg/platform/sources/gewechat.py +++ b/pkg/platform/sources/gewechat.py @@ -85,7 +85,10 @@ class GewechatMessageConverter(adapter.MessageConverter): content_list.append(platform_message.Plain(message["Data"]["Content"]["string"].replace(at_string, '', 1))) # 更优雅的替换改名后@机器人,仅仅限于单独AT的情况 elif "PushContent" in message['Data'] and '在群聊中@了你' in message["Data"]["PushContent"]: - content_list.append(platform_message.At(target=bot_account_id)) + if '@所有人' in message["Data"]["Content"]["string"]: # at全员时候传入atll不当作at自己 + content_list.append(platform_message.AtAll()) + else: + content_list.append(platform_message.At(target=bot_account_id)) content_list.append(platform_message.Plain(re.sub(pattern, '', message["Data"]["Content"]["string"]))) else: content_list = [platform_message.Plain(message["Data"]["Content"]["string"])] @@ -224,10 +227,14 @@ class GewechatEventConverter(adapter.EventConverter): event: dict, bot_account_id: str ) -> platform_events.MessageEvent: - + print(event) + # 排除自己发消息回调回答问题 if event['Wxid'] == event['Data']['FromUserName']['string']: return None - # print(event) + # 排除公众号以及微信团队消息 + if event['Data']['FromUserName']['string'].startswith('gh_')\ + or event['Data']['FromUserName']['string'].startswith('weixin'): + return None message_chain = await self.message_converter.target2yiri(copy.deepcopy(event), bot_account_id) if not message_chain: From 72cd4448611c9c36cedec104fedd223aa21bd464 Mon Sep 17 00:00:00 2001 From: Dong_master <2213070223@qq.com> Date: Tue, 18 Mar 2025 23:14:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A4=84=E7=90=86at=E5=85=A8=E5=91=98?= =?UTF-8?q?=E7=9A=84atall,=E4=BB=A5=E5=8F=8A=E4=BF=AE=E5=A4=8D=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E5=85=AC=E4=BC=97=E5=8F=B7=E5=92=8C=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E5=9B=A2=E9=98=9F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/platform/sources/gewechat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/platform/sources/gewechat.py b/pkg/platform/sources/gewechat.py index 870081ea..869e05c6 100644 --- a/pkg/platform/sources/gewechat.py +++ b/pkg/platform/sources/gewechat.py @@ -227,7 +227,7 @@ class GewechatEventConverter(adapter.EventConverter): event: dict, bot_account_id: str ) -> platform_events.MessageEvent: - print(event) + # print(event) # 排除自己发消息回调回答问题 if event['Wxid'] == event['Data']['FromUserName']['string']: return None