Fix stupidity
This commit is contained in:
+8
-3
@@ -22,10 +22,15 @@ export function startServer(
|
||||
};
|
||||
|
||||
const commands = {
|
||||
join: (id: number, ...args: string[]) => {
|
||||
join: (id: number, args: string[]) => {
|
||||
const room = args[0];
|
||||
roomsMap.getOrInsert(room, [id]);
|
||||
clientRoomMap.getOrInsert(id, room);
|
||||
if (roomsMap.has(room)) {
|
||||
roomsMap.get(room)!.push(id);
|
||||
} else {
|
||||
roomsMap.set(room, [id]);
|
||||
}
|
||||
|
||||
clientRoomMap.getOrInsert(id, room); // not sure about that
|
||||
broadcast(room, `${id} has joined!`);
|
||||
},
|
||||
} as const;
|
||||
|
||||
Reference in New Issue
Block a user