From 4391ad51b1cc74e277a9bef2eaeb555c5422d4dc Mon Sep 17 00:00:00 2001 From: evilbeast Date: Tue, 30 Aug 2022 15:09:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=80=E5=87=BA=E7=BE=A4?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastapi_example/main.py | 8 ++++++++ fastapi_example/models.py | 5 ++++- ntchat/core/wechat.py | 8 ++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/fastapi_example/main.py b/fastapi_example/main.py index a21fc1a..ee143f6 100644 --- a/fastapi_example/main.py +++ b/fastapi_example/main.py @@ -161,6 +161,14 @@ async def add_room_friend(model: models.ModifyRoomNameReqModel): return response_json(1, data) +@app.post("/room/quit_room", summary="退出群", tags=["Room"], + response_model=models.ResponseModel) +@catch_exception() +async def quit_room(model: models.RoomReqModel): + data = client_mgr.get_client(model.guid).quit_room(model.room_wxid) + return response_json(1, data) + + @app.post("/msg/send_text", summary="发送文本消息", tags=["Msg"], response_model=models.ResponseModel) @catch_exception() async def msg_send_text(model: models.SendTextReqModel): diff --git a/fastapi_example/models.py b/fastapi_example/models.py index 83d1425..7db4304 100644 --- a/fastapi_example/models.py +++ b/fastapi_example/models.py @@ -101,8 +101,11 @@ class AddRoomFriendReqModel(ClientReqModel): verify: str -class ModifyRoomNameReqModel(ClientReqModel): +class RoomReqModel(ClientReqModel): room_wxid: str + + +class ModifyRoomNameReqModel(RoomReqModel): name: str diff --git a/ntchat/core/wechat.py b/ntchat/core/wechat.py index 9aef999..8a94790 100644 --- a/ntchat/core/wechat.py +++ b/ntchat/core/wechat.py @@ -349,3 +349,11 @@ class WeChat: } return self.__send_sync(send_type.MT_ADD_FRIEND_MSG, data) + def quit_room(self, room_wxid: str): + """ + 退出群 + """ + data = { + "room_wxid": room_wxid + } + return self.__send(send_type.MT_QUIT_DEL_ROOM_MSG, data)