This commit is contained in:
Soph :3 2024-07-19 04:26:14 +03:00
parent d6b20082ea
commit 094aeb061c
Signed by: sophie
GPG key ID: EDA5D222A0C270F2
3 changed files with 6 additions and 18 deletions

View file

@ -17,7 +17,7 @@ export class Client {
.join("");
this.uniqWsID = crypto.randomUUID();
}
updateRole() {
sendWelcome() {
const profile = Server.profiles.get(this.id)
if(!profile) return;
this.send(new proto.ServerMessage({

View file

@ -86,20 +86,8 @@ export class Room {
particpiant.addClient(ws.data);
}
const welcome = new proto.ServerMessage({
event: proto.ServerMessage_EventType.WELCOME,
welcome: {
id: ws.data.id,
name: particpiant.profile.name,
color: particpiant.profile.color,
room: this.name,
owner: this.owner,
chat: this.chats,
role: particpiant.profile.role,
},
});
ws.data.send(welcome);
ws.data.sendWelcome();
if (particpiant.clients.length <= 1) {
//#region Annouce to everyone that the user has joined
const joinMessage = new proto.ServerMessage({

View file

@ -119,7 +119,7 @@ export class Server {
profile.emit("update");
Server.wses.forEach((z) => {
if (z.data.id == profile.id) {
z?.data?.updateRole();
z?.data?.sendWelcome();
}
});
return;
@ -156,7 +156,7 @@ export class Server {
profile.emit("update");
Server.wses.forEach((z) => {
if (z.data.id == profile.id) {
z?.data?.updateRole();
z?.data?.sendWelcome();
}
});
ws.data.send(
@ -176,7 +176,7 @@ export class Server {
profile.emit("update");
Server.wses.forEach((z) => {
if (z.data.id == profile.id) {
z?.data?.updateRole();
z?.data?.sendWelcome();
}
});