Impl add chatroom members

This commit is contained in:
Changhua 2023-05-06 23:00:22 +08:00
parent 35a03c2186
commit 07ac16ebaa

View File

@ -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 "失败"}