Fix ch message ratelimit and sanitization

This commit is contained in:
Hri7566 2024-07-09 03:05:35 -04:00
parent 138982d54a
commit 5e9c367ea2
1 changed files with 2 additions and 1 deletions

View File

@ -4,7 +4,8 @@ export const ch: ServerEventListener<"ch"> = {
id: "ch", id: "ch",
callback: (msg, socket) => { callback: (msg, socket) => {
// Switch channel // Switch channel
if (!msg._id) return; if (!socket.rateLimits?.normal.ch.attempt()) return;
if (typeof msg._id !== "string") return;
// So technical and convoluted... // So technical and convoluted...
socket.setChannel(msg._id, msg.set); socket.setChannel(msg._id, msg.set);