From 22110d0541a06e84bbdfa442bf2086c09678ade5 Mon Sep 17 00:00:00 2001 From: wolfy01 <45273698+wolfy01@users.noreply.github.com> Date: Tue, 7 Apr 2020 02:04:11 -0400 Subject: [PATCH] Update Message.js --- src/Message.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Message.js b/src/Message.js index b8b79d9..4ed2a24 100644 --- a/src/Message.js +++ b/src/Message.js @@ -30,6 +30,7 @@ module.exports = (cl) => { } }) cl.on("m", msg => { + if (!cl.cursQuota.attempt()) return; if (!(cl.channel && cl.participantId)) return; if (!msg.hasOwnProperty("x")) msg.x = null; if (!msg.hasOwnProperty("y")) msg.y = null; @@ -60,6 +61,15 @@ module.exports = (cl) => { cl.channel.updateCh(); }) cl.on("a", msg => { + if (cl.channel.isLobby(cl.channel._id)) { + if (!cl.chatQuota.attempt()) return; + } else { + if (!(cl.user._id == cl.channel.crown.userId)) { + if (!cl.chatQuota.attempt()) return; + } else { + if (!cl.crowned_chatQuota.attempt()) return; + } + } if (!(cl.channel && cl.participantId)) return; if (!msg.hasOwnProperty('message')) return; if (cl.channel.settings.chat) { @@ -100,6 +110,7 @@ module.exports = (cl) => { cl.server.roomlisteners.delete(cl.connectionid); }) cl.on("userset", msg => { + if (!cl.usersetQuota.attempt()) return; if (!(cl.channel && cl.participantId)) return; if (!msg.hasOwnProperty("set") || !msg.set) msg.set = {}; if (msg.set.hasOwnProperty('name') && typeof msg.set.name == "string") { @@ -165,4 +176,4 @@ module.exports = (cl) => { }) -} \ No newline at end of file +}