From 2a5a9c150cda5b7d70a435f645e3c5ba867e78b4 Mon Sep 17 00:00:00 2001 From: marzavec Date: Wed, 27 Dec 2023 00:38:18 -0800 Subject: [PATCH] added mod perks --- commands/core/join.js | 5 +++++ commands/core/session.js | 6 ++++++ commands/mod/lockroom.js | 3 +-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/commands/core/join.js b/commands/core/join.js index 81e154d..b4b2364 100644 --- a/commands/core/join.js +++ b/commands/core/join.js @@ -151,6 +151,11 @@ export async function run({ // socket.channels.push(channel); socket.channels = [channel]; + // global mod perks + if (isModerator(socket.level)) { + socket.ratelimitImmune = true; + } + nicks.push(userInfo.nick); /* @legacy */ users.push({ ...{ isme: true, isBot: socket.isBot }, ...userInfo }); diff --git a/commands/core/session.js b/commands/core/session.js index 5be594a..58e965b 100644 --- a/commands/core/session.js +++ b/commands/core/session.js @@ -12,6 +12,7 @@ import fs from 'fs'; import jsonwebtoken from 'jsonwebtoken'; import { + isModerator, verifyNickname, } from '../utility/_UAC.js'; import { @@ -140,6 +141,11 @@ export async function run({ socket.muzzled = session.muzzled; socket.banned = session.banned; + // global mod perks + if (isModerator(socket.level)) { + socket.ratelimitImmune = true; + } + socket.hash = server.getSocketHash(socket); socket.hcProtocol = 2; diff --git a/commands/mod/lockroom.js b/commands/mod/lockroom.js index d2eb10c..c27d612 100644 --- a/commands/mod/lockroom.js +++ b/commands/mod/lockroom.js @@ -9,7 +9,6 @@ */ import { - levels, isTrustedUser, isModerator, verifyNickname, @@ -173,7 +172,7 @@ export function chatCheck({ socket, payload, }) { if (socket.channel === 'purgatory') { - if (socket.level >= levels.moderator) { + if (isModerator(socket.level)) { return payload; }