aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/mod/kick.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/commands/mod/kick.js')
-rw-r--r--server/src/commands/mod/kick.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/server/src/commands/mod/kick.js b/server/src/commands/mod/kick.js
index 157592d..75c0d40 100644
--- a/server/src/commands/mod/kick.js
+++ b/server/src/commands/mod/kick.js
@@ -1,19 +1,23 @@
/*
- Description: Forces a change on the target socket's channel, then broadcasts event
+ Description: Forces a change on the target(s) socket's channel, then broadcasts event
*/
exports.run = async (core, server, socket, data) => {
- if (socket.uType === 'user') {
- // ignore if not mod or admin
+ // increase rate limit chance and ignore if not admin or mod
+ if (socket.uType == 'user') {
+ server._police.frisk(socket.remoteAddress, 10);
+
return;
}
+ // check user input
if (typeof data.nick !== 'string') {
if (typeof data.nick !== 'object' && !Array.isArray(data.nick)) {
return;
}
}
+ // find target user(s)
let badClients = server.findSockets({ channel: socket.channel, nick: data.nick });
if (badClients.length === 0) {
@@ -25,6 +29,7 @@ exports.run = async (core, server, socket, data) => {
return;
}
+ // check if found targets are kickable, commit kick
let newChannel = '';
let kicked = [];
for (let i = 0, j = badClients.length; i < j; i++) {
@@ -66,6 +71,7 @@ exports.run = async (core, server, socket, data) => {
text: `Kicked ${kicked.join(', ')}`
}, { channel: socket.channel, uType: 'user' });
+ // stats are fun
core.managers.stats.increment('users-kicked', kicked.length);
};
@@ -75,4 +81,4 @@ exports.info = {
name: 'kick',
usage: 'kick {nick}',
description: 'Silently forces target client(s) into another channel. `nick` may be string or array of strings'
-}; \ No newline at end of file
+};