From 2e4fef6c6613309789de8e56fd6dee20d51fa138 Mon Sep 17 00:00:00 2001 From: Moyuyanli <572490972@qq.com> Date: Mon, 17 Mar 2025 16:02:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=B7=BB=E5=8A=A0=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/platform/sources/gewechat/client.py | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/astrbot/core/platform/sources/gewechat/client.py b/astrbot/core/platform/sources/gewechat/client.py index 026195fc8..7a07afe9c 100644 --- a/astrbot/core/platform/sources/gewechat/client.py +++ b/astrbot/core/platform/sources/gewechat/client.py @@ -115,11 +115,8 @@ class SimpleGewechatClient: abm = AstrBotMessage() - if type_name == "ModContacts": - abm.type = MessageType.OTHER_MESSAGE - abm.raw_message = data - logger.debug(f"abm: {abm}") - return abm + # if type_name == "ModContacts": + # self from_user_name = d["FromUserName"]["string"] # 消息来源 d["to_wxid"] = from_user_name # 用于发信息 @@ -606,3 +603,19 @@ class SimpleGewechatClient: json_blob = await resp.json() logger.debug(f"获取群信息结果: {json_blob}") return json_blob + async def send_message(self, to_wxid, content): + payload = { + "appId": self.appid, + "toWxid": to_wxid, + "content":content + } + + async with aiohttp.ClientSession() as session: + async with session.post( + f"{self.base_url}/message/postText", + headers=self.headers, + json=payload, + ) as resp: + json_blob = await resp.json() + logger.debug(f"获取群信息结果: {json_blob}") + # return json_blob