From 106892e9334954b2a9bc4562f38a9f33d808060e Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Wed, 22 Jan 2025 20:34:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dappid=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E7=9A=84=E9=97=AE=E9=A2=98=E5=92=8C=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=BE=A4=E8=81=8Aat=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=92=8C=E7=BE=A4=E8=81=8A@=E7=9A=84sender=20username?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/platform/sources/gewechat/client.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/astrbot/core/platform/sources/gewechat/client.py b/astrbot/core/platform/sources/gewechat/client.py index d009cc4b..886c053f 100644 --- a/astrbot/core/platform/sources/gewechat/client.py +++ b/astrbot/core/platform/sources/gewechat/client.py @@ -64,7 +64,7 @@ class SimpleGewechatClient(): user_id = "" # 发送人 wxid content = d['Content']['string'] # 消息内容 user_real_name = d['PushContent'].split(' : ')[0] # 真实昵称 - user_real_name.replace('在群聊中@了你', '') # trick + user_real_name = user_real_name.replace('在群聊中@了你', '') # trick abm.self_id = data['Wxid'] # 机器人的 wxid at_me = False if "@chatroom" in from_user_name: @@ -80,7 +80,8 @@ class SimpleGewechatClient(): # at msg_source = d['MsgSource'] - if f'' in msg_source: + if f'' in msg_source \ + or f'' in msg_source: at_me = True else: @@ -135,7 +136,7 @@ class SimpleGewechatClient(): logger.info(f"设置回调结果: {json_blob}") if json_blob['ret'] != 200: raise Exception(f"设置回调失败: {json_blob}") - logger.info(f"将在 {callback_url} 上接收 gewechat 下发的消息。") + logger.info(f"将在 {callback_url} 上接收 gewechat 下发的消息。如果一直没收到消息请先尝试重启 AstrBot。") async def start_polling(self): @@ -243,7 +244,7 @@ class SimpleGewechatClient(): logger.warning(f"未知状态: {status}") await asyncio.sleep(5) - if not self.appid and appid: + if appid: sp.put(f"gewechat-appid-{nickname}", appid) self.appid = appid logger.info(f"已保存 APPID: {appid}")