aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core/invite.js
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2018-04-29 07:29:38 +0200
committermarzavec <admin@marzavec.com>2018-04-29 07:29:46 +0200
commit8820968c7378b03af57abce3d3a522cff318c9b9 (patch)
tree41bb23bdbddd484be3567732c531c11e31b22c32 /server/src/commands/core/invite.js
parentadded software link to readme (diff)
downloadhackchat-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.js20
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 = {