From 033f8d3c2aec066a9cf1d07adb406d06fa463708 Mon Sep 17 00:00:00 2001 From: wolfy01 <45273698+wolfy01@users.noreply.github.com> Date: Tue, 7 Apr 2020 02:42:12 -0400 Subject: [PATCH] quotas --- src/Client.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Client.js b/src/Client.js index 6527005..b7f5b54 100644 --- a/src/Client.js +++ b/src/Client.js @@ -1,3 +1,5 @@ +const config = require('./db/config'); +const quotas = config.quotas; const RateLimit = require('./RateLimit.js').RateLimit; const RateLimitChain = require('./RateLimit.js').RateLimitChain; const Room = require("./Room.js"); @@ -17,11 +19,12 @@ class Client extends EventEmitter { this.destroied = false; this.bindEventListeners(); this.quotas = { - chat: new RateLimitChain(4, 4000), - name: new RateLimitChain(30, 30 * 60000), - cursor: new RateLimit(16), - kickban: new RateLimitChain(2, 1000), - crowned_chat: new RateLimitChain(10, 2000) + chat: new RateLimitChain(quotas.chat.amount, quotas.chat.time), + name: new RateLimitChain(quotas.name.amount, quotas.name.time), + room: new RateLimit(quotas.room.time), + cursor: new RateLimit(quotas.cursor.time), + kickban: new RateLimitChain(quotas.kickban.amount, quotas.kickban.time), + crowned_chat: new RateLimitChain(quotas.crowned_chat.amount, quotas.crowned_chat.time) } require('./Message.js')(this); }