From f353ecbd9e9e8e409303bb4f5c5590e95f579869 Mon Sep 17 00:00:00 2001 From: marzavec Date: Sun, 7 Apr 2019 17:04:10 -0700 Subject: refactoring 2 of 2 --- server/src/commands/core/changenick.js | 4 ++-- server/src/commands/core/chat.js | 4 ++-- server/src/commands/core/emote.js | 4 ++-- server/src/commands/core/help.js | 4 ++-- server/src/commands/core/invite.js | 2 +- server/src/commands/core/join.js | 2 +- server/src/commands/core/move.js | 2 +- server/src/commands/core/whisper.js | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-) (limited to 'server/src/commands/core') diff --git a/server/src/commands/core/changenick.js b/server/src/commands/core/changenick.js index ae057b3..cb6d1d0 100644 --- a/server/src/commands/core/changenick.js +++ b/server/src/commands/core/changenick.js @@ -7,7 +7,7 @@ const verifyNickname = (nick) => /^[a-zA-Z0-9_]{1,24}$/.test(nick); // module main exports.run = async (core, server, socket, data) => { - if (server._police.frisk(socket.remoteAddress, 6)) { + if (server.police.frisk(socket.remoteAddress, 6)) { return server.reply({ cmd: 'warn', text: 'You are changing nicknames too fast. Wait a moment before trying again.' @@ -31,7 +31,7 @@ exports.run = async (core, server, socket, data) => { // prevent admin impersonation // TODO: prevent mod impersonation if (newNick.toLowerCase() == core.config.adminName.toLowerCase()) { - server._police.frisk(socket.remoteAddress, 4); + server.police.frisk(socket.remoteAddress, 4); return server.reply({ cmd: 'warn', diff --git a/server/src/commands/core/chat.js b/server/src/commands/core/chat.js index bb9584e..7b7e79e 100644 --- a/server/src/commands/core/chat.js +++ b/server/src/commands/core/chat.js @@ -24,12 +24,12 @@ exports.run = async (core, server, socket, data) => { if (!text) { // lets not send objects or empty text, yea? - return server._police.frisk(socket.remoteAddress, 13); + return server.police.frisk(socket.remoteAddress, 13); } // check for spam let score = text.length / 83 / 4; - if (server._police.frisk(socket.remoteAddress, score)) { + if (server.police.frisk(socket.remoteAddress, score)) { return server.reply({ cmd: 'warn', text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.' diff --git a/server/src/commands/core/emote.js b/server/src/commands/core/emote.js index 40fcff2..f51f854 100644 --- a/server/src/commands/core/emote.js +++ b/server/src/commands/core/emote.js @@ -24,12 +24,12 @@ exports.run = async (core, server, socket, payload) => { if (!text) { // lets not send objects or empty text, yea? - return server._police.frisk(socket.remoteAddress, 8); + return server.police.frisk(socket.remoteAddress, 8); } // check for spam let score = text.length / 83 / 4; - if (server._police.frisk(socket.remoteAddress, score)) { + if (server.police.frisk(socket.remoteAddress, score)) { return server.reply({ cmd: 'warn', text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.' diff --git a/server/src/commands/core/help.js b/server/src/commands/core/help.js index 51f6d87..8eccdb6 100644 --- a/server/src/commands/core/help.js +++ b/server/src/commands/core/help.js @@ -8,7 +8,7 @@ const stripIndents = require('common-tags').stripIndents; // module main exports.run = async (core, server, socket, payload) => { // check for spam - if (server._police.frisk(socket.remoteAddress, 2)) { + if (server.police.frisk(socket.remoteAddress, 2)) { return server.reply({ cmd: 'warn', text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.' @@ -27,7 +27,7 @@ exports.run = async (core, server, socket, payload) => { API: {cmd: 'help', command: ''}`; reply += '\n\n-------------------------------------\n\n'; - let categories = core.commands.categories().sort(); + let categories = core.commands.categoriesList.sort(); for (let i = 0, j = categories.length; i < j; i++) { reply += `${categories[i].replace('../src/commands/', '').replace(/^\w/, c => c.toUpperCase())} Commands:\n`; let catCommands = core.commands.all(categories[i]).sort((a, b) => a.info.name.localeCompare(b.info.name)); diff --git a/server/src/commands/core/invite.js b/server/src/commands/core/invite.js index 046e47a..70393b1 100644 --- a/server/src/commands/core/invite.js +++ b/server/src/commands/core/invite.js @@ -8,7 +8,7 @@ const verifyNickname = (nick) => /^[a-zA-Z0-9_]{1,24}$/.test(nick); // module main exports.run = async (core, server, socket, data) => { // check for spam - if (server._police.frisk(socket.remoteAddress, 2)) { + if (server.police.frisk(socket.remoteAddress, 2)) { return server.reply({ cmd: 'warn', text: 'You are sending invites too fast. Wait a moment before trying again.' diff --git a/server/src/commands/core/join.js b/server/src/commands/core/join.js index ce900db..965a8bc 100644 --- a/server/src/commands/core/join.js +++ b/server/src/commands/core/join.js @@ -55,7 +55,7 @@ exports.parseNickname = (core, data) => { // module main exports.run = async (core, server, socket, data) => { // check for spam - if (server._police.frisk(socket.remoteAddress, 3)) { + if (server.police.frisk(socket.remoteAddress, 3)) { return server.reply({ cmd: 'warn', text: 'You are joining channels too fast. Wait a moment and try again.' diff --git a/server/src/commands/core/move.js b/server/src/commands/core/move.js index e85f481..8e97a06 100644 --- a/server/src/commands/core/move.js +++ b/server/src/commands/core/move.js @@ -5,7 +5,7 @@ // module main exports.run = async (core, server, socket, data) => { // check for spam - if (server._police.frisk(socket.remoteAddress, 6)) { + if (server.police.frisk(socket.remoteAddress, 6)) { return server.reply({ cmd: 'warn', text: 'You are changing channels too fast. Wait a moment before trying again.' diff --git a/server/src/commands/core/whisper.js b/server/src/commands/core/whisper.js index c515d43..109889d 100644 --- a/server/src/commands/core/whisper.js +++ b/server/src/commands/core/whisper.js @@ -26,12 +26,12 @@ exports.run = async (core, server, socket, payload) => { if (!text) { // lets not send objects or empty text, yea? - return server._police.frisk(socket.remoteAddress, 13); + return server.police.frisk(socket.remoteAddress, 13); } // check for spam let score = text.length / 83 / 4; - if (server._police.frisk(socket.remoteAddress, score)) { + if (server.police.frisk(socket.remoteAddress, score)) { return server.reply({ cmd: 'warn', text: 'You are sending too much text. Wait a moment and try again.\nPress the up arrow key to restore your last message.' -- cgit v1.2.1