Impl AddChatrootMembers

This commit is contained in:
Changhua
2023-02-28 20:14:22 +08:00
parent a4989a3ad6
commit 7b8fd50dfa
10 changed files with 146 additions and 4 deletions
+6 -1
View File
@@ -51,7 +51,12 @@ def main():
LOG.info(f"Tables:\n{wcf.get_tables('db')}")
LOG.info(f"Results:\n{wcf.query_sql('MicroMsg.db', 'SELECT * FROM Contact LIMIT 1;')}")
# wcf.accept_new_friend("v3", "v4") # 需要真正的 V3、V4 信息
# 需要真正的 V3、V4 信息
# wcf.accept_new_friend("v3", "v4")
# 填写正确的群 ID 和成员 wxid
# ret = wcf.add_chatroom_members("chatroom id", "wxid1,wxid2,wxid3,...")
# LOG.info(f"add_chatroom_members: {ret}")
# 一直运行
wcf.keep_running()
+10 -1
View File
@@ -70,7 +70,7 @@ class Wcf():
cmd = f"{WCF_ROOT}/wcf.exe start {'debug' if debug else ''}"
if os.system(cmd) != 0:
self.LOG.error("初始化失败!")
return
exit(-1)
# 连接 RPC
self.cmd_socket = pynng.Pair1() # Client --> Server,发送消息
@@ -358,3 +358,12 @@ class Wcf():
friends.append(cnt)
return friends
def add_chatroom_members(self, roomid: str, wxids: str) -> int:
"""添加群成员"""
req = wcf_pb2.Request()
req.func = wcf_pb2.FUNC_ADD_ROOM_MEMBERS # FUNC_ADD_ROOM_MEMBERS
req.m.roomid = roomid
req.m.wxids = wxids
rsp = self._send_request(req)
return rsp.status