aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2019-04-08 02:04:10 +0200
committermarzavec <admin@marzavec.com>2019-04-08 02:04:10 +0200
commitf353ecbd9e9e8e409303bb4f5c5590e95f579869 (patch)
tree3345967ae59a46f59fe86c0d6fda432115594927 /server/src/commands/core
parentrefactoring 1 of 2 (diff)
downloadhackchat-f353ecbd9e9e8e409303bb4f5c5590e95f579869.tar.gz
hackchat-f353ecbd9e9e8e409303bb4f5c5590e95f579869.zip
refactoring 2 of 2
Diffstat (limited to 'server/src/commands/core')
-rw-r--r--server/src/commands/core/changenick.js4
-rw-r--r--server/src/commands/core/chat.js4
-rw-r--r--server/src/commands/core/emote.js4
-rw-r--r--server/src/commands/core/help.js4
-rw-r--r--server/src/commands/core/invite.js2
-rw-r--r--server/src/commands/core/join.js2
-rw-r--r--server/src/commands/core/move.js2
-rw-r--r--server/src/commands/core/whisper.js4
8 files changed, 13 insertions, 13 deletions
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: '<command name>'}`;
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.'