This commit is contained in:
Hri7566 2023-09-10 06:50:17 -04:00
parent d99523d94f
commit 8831188137
3 changed files with 9 additions and 10 deletions

View File

@ -293,7 +293,7 @@ export class Channel extends EventEmitter {
} }
}); });
this.on("a", (msg: ServerEvents["a"], socket: Socket) => { this.on("message", (msg: ServerEvents["a"], socket: Socket) => {
if (!msg.message) return; if (!msg.message) return;
let outgoing: ClientEvents["a"] = { let outgoing: ClientEvents["a"] = {

View File

@ -106,21 +106,20 @@ export class Socket extends EventEmitter {
this.desiredChannel.set = set; this.desiredChannel.set = set;
let channel; let channel;
try { for (const ch of channelList) {
for (const ch of channelList.values()) { if (ch.getID() == _id) {
if (ch.getID() == this.desiredChannel._id) { channel = ch;
channel = ch;
break;
}
} }
} catch (err) {} }
logger.debug("Found channel:", channel);
// Does channel exist? // Does channel exist?
if (channel) { if (channel) {
// Exists, join normally // Exists, join normally
channel.join(this); channel.join(this);
} else { } else {
// Doesn't exist, join with crown // Doesn't exist, create
channel = new Channel( channel = new Channel(
this.desiredChannel._id, this.desiredChannel._id,
this.desiredChannel.set this.desiredChannel.set

View File

@ -7,6 +7,6 @@ export const a: ServerEventListener<"a"> = {
const ch = socket.getCurrentChannel(); const ch = socket.getCurrentChannel();
if (!ch) return; if (!ch) return;
ch.emit("a", msg, socket); ch.emit("message", msg, socket);
} }
}; };