Update messages

This commit is contained in:
Hri7566 2024-09-19 20:27:13 -04:00
parent 9fcc3864c0
commit 937082694e
5 changed files with 42 additions and 15 deletions

View File

@ -1,6 +1,9 @@
import { Logger } from "~/util/Logger";
import { ChannelList } from "../../../../channel/ChannelList";
import { ServerEventListener, TChannelFlags } from "../../../../util/types";
const logger = new Logger("Channel flag input");
export const ch_flag: ServerEventListener<"ch_flag"> = {
id: "ch_flag",
callback: async (msg, socket) => {
@ -17,7 +20,7 @@ export const ch_flag: ServerEventListener<"ch_flag"> = {
if (typeof msg.key !== "string") return;
if (typeof msg.value === "undefined") return;
const ch = ChannelList.getList().find(c => c.getID() == chid);
const ch = ChannelList.getChannel(chid);
if (!ch) return;
ch.setFlag(

View File

@ -1,5 +1,5 @@
import { forceloadChannel } from "../../../../channel/forceLoad";
import { ServerEventListener } from "../../../../util/types";
import { forceloadChannel } from "~/channel/forceload";
import { ServerEventListener } from "~/util/types";
export const forceload: ServerEventListener<"forceload"> = {
id: "forceload",

View File

@ -0,0 +1,12 @@
import { forceloadChannel, unforceloadChannel } from "~/channel/forceload";
import { ServerEventListener } from "~/util/types";
export const unforceload: ServerEventListener<"unforceload"> = {
id: "unforceload",
callback: async (msg, socket) => {
// Unforceload channel
if (typeof msg._id !== "string") return;
unforceloadChannel(msg._id);
}
};

View File

@ -1,17 +1,20 @@
import { EventGroup, eventGroups } from "../../events";
import { admin_chat } from "./handlers/admin_chat";
import { ch_flag } from "./handlers/ch_flag";
import { clear_chat } from "./handlers/clear_chat";
export const EVENT_GROUP_ADMIN = new EventGroup("admin");
import { color } from "./handlers/color";
import { eval_msg } from "./handlers/eval";
import { forceload } from "./handlers/forceload";
import { move } from "./handlers/move";
import { name } from "./handlers/name";
import { notification } from "./handlers/notification";
import { rename_channel } from "./handlers/rename_channel";
import { restart } from "./handlers/restart";
import { tag } from "./handlers/tag";
import { unforceload } from "./handlers/unforceload";
import { user_flag } from "./handlers/user_flag";
// EVENT_GROUP_ADMIN.add(color);
@ -19,17 +22,20 @@ import { user_flag } from "./handlers/user_flag";
// EVENT_GROUP_ADMIN.add(user_flag);
EVENT_GROUP_ADMIN.addMany(
color,
name,
user_flag,
clear_chat,
notification,
restart,
move,
rename_channel,
admin_chat,
eval_msg,
tag
color,
name,
user_flag,
clear_chat,
notification,
restart,
move,
rename_channel,
admin_chat,
eval_msg,
tag,
ch_flag,
forceload,
unforceload
);
eventGroups.push(EVENT_GROUP_ADMIN);

View File

@ -17,6 +17,9 @@ import { kickban } from "./handlers/kickban";
import { bye } from "./handlers/bye";
import { chown } from "./handlers/chown";
import { unban } from "./handlers/unban";
import { plus_custom } from "./handlers/+custom";
import { minus_custom } from "./handlers/-custom";
import { custom } from "./handlers/custom";
// Imagine not having an "addMany" function...
@ -48,7 +51,10 @@ EVENTGROUP_USER.addMany(
kickban,
unban,
bye,
chown
chown,
plus_custom,
minus_custom,
custom
);
eventGroups.push(EVENTGROUP_USER);