summary refs log tree commit diff
path: root/commands.ts
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2025-01-22 10:18:16 +0200
committerWlodekM <[email protected]>2025-01-22 10:18:16 +0200
commit2e3e1a555e97ab84d5b7e814ec75318e4bdf8809 (patch)
tree97820a5d5200590fa934e4ff33707fd66271fc14 /commands.ts
parent14c92b10915543aa760374ce398bc0b3b95f90f6 (diff)
some fixes
Diffstat (limited to 'commands.ts')
-rw-r--r--commands.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/commands.ts b/commands.ts
index 961000d..960b8a8 100644
--- a/commands.ts
+++ b/commands.ts
@@ -82,9 +82,9 @@ export const commands: {[key: string]: Command} = {
         command({ user, server, args }) {
             if (args.length < 1) return user.socket.send("Please provide username");
             if (![...server.users.entries()].find(([_, usr]) => usr.username == args[0])) return user.socket.send("User not found");
-            const userFound = Object.values(server.users).find((usr) => usr.username == args[0]);
-            userFound.id = Object.keys(server.users).find((usr) => (server.users.get(usr) as User).username == args[0]);
-            user.socket.send(`${userFound.username}\nClient: ${userFound.client ?? "<Unknown>"}\nID: ${userFound.id}`);
+            const [id, userFound] = [...server.users.entries()].find(([_, usr]) => usr.username == args[0]) ?? [];
+            if (!userFound) return user.socket.send("User not found");
+            user.socket.send(`${userFound.username}\nClient: ${userFound.client ?? "<Unknown>"}\nID: ${id}`);
         },
     },
     users: {