Add bye message

This commit is contained in:
Hri7566 2024-02-01 08:31:34 -05:00
parent 2f3311be1f
commit 0ece65e940
3 changed files with 15 additions and 2 deletions

View File

@ -409,7 +409,9 @@ export class Socket extends EventEmitter {
public subscribeToChannelList() {
ChannelList.subscribe(this.id);
const firstList = ChannelList.getPublicList().map(v => v.getInfo(this._id));
const firstList = ChannelList.getPublicList().map(v =>
v.getInfo(this._id)
);
this.sendChannelList(firstList);
}

View File

@ -0,0 +1,9 @@
import { ServerEventListener } from "../../../../util/types";
export const bye: ServerEventListener<"bye"> = {
id: "bye",
callback: (msg, socket) => {
// Leave server
socket.destroy();
}
};

View File

@ -14,6 +14,7 @@ import { minus_ls } from "./handlers/-ls";
import { admin_message } from "./handlers/admin_message";
import { chset } from "./handlers/chset";
import { kickban } from "./handlers/kickban";
import { bye } from "./handlers/bye";
// Imagine not having an "addMany" function...
@ -42,7 +43,8 @@ EVENTGROUP_USER.addMany(
minus_ls,
admin_message,
chset,
kickban
kickban,
bye
);
eventGroups.push(EVENTGROUP_USER);