From 7cc24200a6765a949c90ba202c26e2df7c773a31 Mon Sep 17 00:00:00 2001 From: Alex <74823568+zRitsu@users.noreply.github.com> Date: Fri, 21 Oct 2022 00:17:02 -0300 Subject: [PATCH] remove multi-user with same data... --- rpc_client.py | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/rpc_client.py b/rpc_client.py index 972e1e4..5cabd75 100644 --- a/rpc_client.py +++ b/rpc_client.py @@ -587,39 +587,28 @@ async def handle_socket(self, uri): for i in bot_id: self.bots_socket[uri].add(i) - users_ws = data.pop("users", None) + user_ws = data.pop("user", None) - if not users_ws: + if not user_ws: continue - else: - users_ws = [u for u in users_ws if u in user_clients] + self.users_socket[uri].add(user_ws) try: - if not data["info"].get("members"): - data["info"]["members"] = len(users_ws) + user = user_clients[user_ws]["user"] except KeyError: - pass - - for u_id in users_ws: - - self.users_socket[uri].add(u_id) - - try: - user = user_clients[u_id]["user"] - except KeyError: - continue + continue - self.gui.update_log(f"op: {data['op']} | {user} {u_id} | " - f"bot: {(bot_name + ' ') if bot_name else ''}[{bot_id}]", - log_type="info") + self.gui.update_log(f"op: {data['op']} | {user} {user_ws} | " + f"bot: {(bot_name + ' ') if bot_name else ''}[{bot_id}]", + log_type="info") - try: - self.last_data[u_id][bot_id] = data - except KeyError: - self.last_data[u_id] = {bot_id: data} + try: + self.last_data[user_ws][bot_id] = data + except KeyError: + self.last_data[user_ws] = {bot_id: data} - self.process_data(u_id, bot_id, data) + self.process_data(user_ws, bot_id, data) elif msg.type in (aiohttp.WSMsgType.CLOSED, aiohttp.WSMsgType.CLOSING,