aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/mod/dumb.js
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2018-06-04 09:07:24 +0200
committermarzavec <admin@marzavec.com>2018-06-04 09:07:24 +0200
commite35fff59ba30e78046c9212e74fce9aef56c6e93 (patch)
treec7d3e0cd75f5a6063d629d4295952488907e9562 /server/src/commands/mod/dumb.js
parentCompleted protocol decoupling (diff)
downloadhackchat-e35fff59ba30e78046c9212e74fce9aef56c6e93.tar.gz
hackchat-e35fff59ba30e78046c9212e74fce9aef56c6e93.zip
cleaned up and commented modules
Diffstat (limited to 'server/src/commands/mod/dumb.js')
-rw-r--r--server/src/commands/mod/dumb.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/server/src/commands/mod/dumb.js b/server/src/commands/mod/dumb.js
index 0708fb8..675ecd6 100644
--- a/server/src/commands/mod/dumb.js
+++ b/server/src/commands/mod/dumb.js
@@ -8,15 +8,19 @@ exports.init = (core) => {
}
exports.run = async (core, server, socket, data) => {
+ // increase rate limit chance and ignore if not admin or mod
if (socket.uType == 'user') {
- // ignore if not mod or admin
+ server._police.frisk(socket.remoteAddress, 10);
+
return;
}
+ // check user input
if (typeof data.nick !== 'string') {
return;
}
+ // find target user
let badClient = server.findSockets({ channel: socket.channel, nick: data.nick });
if (badClient.length === 0) {
@@ -30,6 +34,7 @@ exports.run = async (core, server, socket, data) => {
badClient = badClient[0];
+ // likely dont need this, muting mods and admins is fine
if (badClient.uType !== 'user') {
server.reply({
cmd: 'warn',
@@ -39,19 +44,21 @@ exports.run = async (core, server, socket, data) => {
return;
}
+ // store hash in mute list
let record = core.muzzledHashes[badClient.hash] = {
dumb:true
}
+ // store allies if needed
if(data.allies && Array.isArray(data.allies)){
record.allies = data.allies;
}
+ // notify mods
server.broadcast({
cmd: 'info',
text: `${socket.nick} muzzled ${data.nick} in ${socket.channel}, userhash: ${badClient.hash}`
}, { uType: 'mod' });
-
}
exports.requiredData = ['nick'];