From ad37ff5048819b987ec95ec35e43386c8fa4d99b Mon Sep 17 00:00:00 2001 From: Zhenyi Wang Date: Thu, 27 Mar 2025 11:17:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20gewechat=20client=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=80=9A=E8=AE=AF=E5=BD=95=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/platform/sources/gewechat/client.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/astrbot/core/platform/sources/gewechat/client.py b/astrbot/core/platform/sources/gewechat/client.py index abab1790..157145ad 100644 --- a/astrbot/core/platform/sources/gewechat/client.py +++ b/astrbot/core/platform/sources/gewechat/client.py @@ -735,3 +735,22 @@ class SimpleGewechatClient: json_blob = await resp.json() logger.debug(f"获取群信息结果: {json_blob}") return json_blob + + async def get_contacts_list(self): + """ + 获取通讯录列表 + 见 https://apifox.com/apidoc/shared/69ba62ca-cb7d-437e-85e4-6f3d3df271b1/api-196794504 + """ + payload = { + "appId": self.appid + } + + async with aiohttp.ClientSession() as session: + async with session.post( + f"{self.base_url}/contacts/fetchContactsList", + headers=self.headers, + json=payload, + ) as resp: + json_blob = await resp.json() + logger.debug(f"获取通讯录列表结果: {json_blob}") + return json_blob