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;
let outgoing: ClientEvents["a"] = {

View File

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

View File

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