From 07ac16ebaa5b3d5319dd1b59aaaafc3f217d3bb5 Mon Sep 17 00:00:00 2001 From: Changhua Date: Sat, 6 May 2023 23:00:22 +0800 Subject: [PATCH] Impl add chatroom members --- http/wcfhttp/core.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/http/wcfhttp/core.py b/http/wcfhttp/core.py index 299f004..0164d6b 100644 --- a/http/wcfhttp/core.py +++ b/http/wcfhttp/core.py @@ -42,6 +42,7 @@ class Http(FastAPI): self.add_api_route("/emotion", self.send_emotion, methods=["POST"], summary="发送表情消息") self.add_api_route("/sql", self.query_sql, methods=["POST"], summary="执行 SQL,如果数据量大注意分页,以免 OOM") self.add_api_route("/new-friend", self.accept_new_friend, methods=["POST"], summary="通过好友申请") + self.add_api_route("/chatroom-member", self.add_chatroom_members, methods=["POST"], summary="添加群成员") self.add_api_route("/login", self.is_login, methods=["GET"], summary="获取登录状态") self.add_api_route("/wxid", self.get_self_wxid, methods=["GET"], summary="获取登录账号 wxid") @@ -198,3 +199,10 @@ class Http(FastAPI): """通过好友申请""" ret = self.wcf.accept_new_friend(v3, v4, scene) return {"status": ret, "message": "成功"if ret == 1 else "失败"} + + def add_chatroom_members(self, + roomid: str = Body("xxxxxxxx@chatroom", description="待加群的 id"), + wxids: str = Body("wxid_xxxxxxxxxxxxx", description="要加到群里的 wxid,多个用逗号分隔")) -> dict: + """添加群成员""" + ret = self.wcf.add_chatroom_members(roomid, wxids) + return {"status": ret, "message": "成功"if ret == 1 else "失败"}