diff options
author | marzavec <admin@marzavec.com> | 2018-04-29 07:29:38 +0200 |
---|---|---|
committer | marzavec <admin@marzavec.com> | 2018-04-29 07:29:46 +0200 |
commit | 8820968c7378b03af57abce3d3a522cff318c9b9 (patch) | |
tree | 41bb23bdbddd484be3567732c531c11e31b22c32 /server/src/commands/core/invite.js | |
parent | added software link to readme (diff) | |
download | hackchat-8820968c7378b03af57abce3d3a522cff318c9b9.tar.gz hackchat-8820968c7378b03af57abce3d3a522cff318c9b9.zip |
misc server changes and new modules
Diffstat (limited to 'server/src/commands/core/invite.js')
-rw-r--r-- | server/src/commands/core/invite.js | 20 |
1 files changed, 10 insertions, 10 deletions
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 = { |