From 7c1e8ce48c0290a2238939e5607bed5ce1648974 Mon Sep 17 00:00:00 2001 From: BigFace123 <30950532+BigFace123@users.noreply.github.com> Date: Sat, 12 Apr 2025 10:17:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0gewechat=E8=A2=ABat=E4=BA=BAw?= =?UTF-8?q?xid=E8=8E=B7=E5=8F=96=EF=BC=8CAstrBotMessage=E6=B7=BB=E5=8A=A0b?= =?UTF-8?q?e=5Fat=5Fwxid=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/platform/astrbot_message.py | 2 ++ astrbot/core/platform/sources/gewechat/client.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/astrbot/core/platform/astrbot_message.py b/astrbot/core/platform/astrbot_message.py index e7bd4bd9c..54ed51e80 100644 --- a/astrbot/core/platform/astrbot_message.py +++ b/astrbot/core/platform/astrbot_message.py @@ -62,6 +62,8 @@ class AstrBotMessage: raw_message: object timestamp: int # 消息时间戳 + be_at_wxid: List[str] # gewechat用的群组内at信息,用于机器人获取被at的wxid + def __init__(self) -> None: self.timestamp = int(time.time()) diff --git a/astrbot/core/platform/sources/gewechat/client.py b/astrbot/core/platform/sources/gewechat/client.py index ccecc0c71..fb1f13663 100644 --- a/astrbot/core/platform/sources/gewechat/client.py +++ b/astrbot/core/platform/sources/gewechat/client.py @@ -152,9 +152,13 @@ class SimpleGewechatClient: # at # content = content.split('\u2005')[1] content = re.sub(r"@[^\u2005]*\u2005", "", content) + abm.be_at_wxid = re.findall(r')',d["MsgSource"]) + abm.group_id = from_user_name # at msg_source = d["MsgSource"] + + if ( f"" in msg_source or f"" in msg_source