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() { public subscribeToChannelList() {
ChannelList.subscribe(this.id); 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); 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 { admin_message } from "./handlers/admin_message";
import { chset } from "./handlers/chset"; import { chset } from "./handlers/chset";
import { kickban } from "./handlers/kickban"; import { kickban } from "./handlers/kickban";
import { bye } from "./handlers/bye";
// Imagine not having an "addMany" function... // Imagine not having an "addMany" function...
@ -42,7 +43,8 @@ EVENTGROUP_USER.addMany(
minus_ls, minus_ls,
admin_message, admin_message,
chset, chset,
kickban kickban,
bye
); );
eventGroups.push(EVENTGROUP_USER); eventGroups.push(EVENTGROUP_USER);