Skip to content

Commit

Permalink
remove multi-user with same data...
Browse files Browse the repository at this point in the history
  • Loading branch information
zRitsu committed Oct 21, 2022
1 parent 5c95c86 commit 7cc2420
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions rpc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7cc2420

Please sign in to comment.