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