aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core/invite.js
diff options
context:
space:
mode:
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 = {