From ad37ff5048819b987ec95ec35e43386c8fa4d99b Mon Sep 17 00:00:00 2001 From: Zhenyi Wang Date: Thu, 27 Mar 2025 11:17:52 +0800 Subject: [PATCH 1/2] =?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 abab1790b..157145add 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 From 333c2d92995c6d8c728a133beecc053ac6522ed3 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 27 Mar 2025 03:21:42 +0000 Subject: [PATCH 2/2] :balloon: auto fixes by pre-commit hooks --- astrbot/core/platform/sources/gewechat/client.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/astrbot/core/platform/sources/gewechat/client.py b/astrbot/core/platform/sources/gewechat/client.py index 157145add..ccecc0c71 100644 --- a/astrbot/core/platform/sources/gewechat/client.py +++ b/astrbot/core/platform/sources/gewechat/client.py @@ -741,9 +741,7 @@ class SimpleGewechatClient: 获取通讯录列表 见 https://apifox.com/apidoc/shared/69ba62ca-cb7d-437e-85e4-6f3d3df271b1/api-196794504 """ - payload = { - "appId": self.appid - } + payload = {"appId": self.appid} async with aiohttp.ClientSession() as session: async with session.post(