From 8820968c7378b03af57abce3d3a522cff318c9b9 Mon Sep 17 00:00:00 2001 From: marzavec Date: Sat, 28 Apr 2018 22:29:38 -0700 Subject: misc server changes and new modules --- server/src/commands/core/invite.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'server/src/commands/core/invite.js') diff --git a/server/src/commands/core/invite.js b/server/src/commands/core/invite.js index a6412e1..bd85812 100644 --- a/server/src/commands/core/invite.js +++ b/server/src/commands/core/invite.js @@ -9,6 +9,15 @@ const verifyNickname = (nick) => { }; exports.run = async (core, server, socket, data) => { + if (server._police.frisk(socket.remoteAddress, 2)) { + server.reply({ + cmd: 'warn', + text: 'You are sending invites too fast. Wait a moment before trying again.' + }, socket); + + return; + } + if (typeof data.nick !== 'string') { return; } @@ -22,16 +31,7 @@ exports.run = async (core, server, socket, data) => { // They invited themself return; } - - if (server._police.frisk(socket.remoteAddress, 2)) { - server.reply({ - cmd: 'warn', - text: 'You are sending invites too fast. Wait a moment before trying again.' - }, socket); - - return; - } - + let channel = Math.random().toString(36).substr(2, 8); let payload = { -- cgit v1.2.1