forked from Hri7566/mpp-server-dev2
This commit is contained in:
parent
d99523d94f
commit
8831188137
|
@ -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"] = {
|
||||
|
|
|
@ -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) {
|
||||
channel = ch;
|
||||
break;
|
||||
}
|
||||
for (const ch of channelList) {
|
||||
if (ch.getID() == _id) {
|
||||
channel = ch;
|
||||
}
|
||||
} 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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue