aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/mod
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2018-06-03 20:08:35 +0200
committermarzavec <admin@marzavec.com>2018-06-03 20:08:35 +0200
commit62daa4893f374c1cbbecc63e4f1d4eec3fd29325 (patch)
treef5677c91c86efd60eb78d4c6b0258b17c1926074 /server/src/commands/mod
parentMerge pull request #16 from OpSimple/master (diff)
downloadhackchat-62daa4893f374c1cbbecc63e4f1d4eec3fd29325.tar.gz
hackchat-62daa4893f374c1cbbecc63e4f1d4eec3fd29325.zip
Completed protocol decoupling
Diffstat (limited to '')
-rw-r--r--server/src/commands/mod/dumb.js14
-rw-r--r--server/src/commands/mod/speak.js11
2 files changed, 12 insertions, 13 deletions
diff --git a/server/src/commands/mod/dumb.js b/server/src/commands/mod/dumb.js
index ef2c5b2..0708fb8 100644
--- a/server/src/commands/mod/dumb.js
+++ b/server/src/commands/mod/dumb.js
@@ -1,4 +1,4 @@
-/*
+/*
* Description: Make a user (spammer) dumb
* Author: simple
*/
@@ -16,7 +16,7 @@ exports.run = async (core, server, socket, data) => {
if (typeof data.nick !== 'string') {
return;
}
-
+
let badClient = server.findSockets({ channel: socket.channel, nick: data.nick });
if (badClient.length === 0) {
@@ -38,20 +38,20 @@ exports.run = async (core, server, socket, data) => {
return;
}
-
+
let record = core.muzzledHashes[badClient.hash] = {
dumb:true
}
-
+
if(data.allies && Array.isArray(data.allies)){
record.allies = data.allies;
}
-
+
server.broadcast({
cmd: 'info',
text: `${socket.nick} muzzled ${data.nick} in ${socket.channel}, userhash: ${badClient.hash}`
}, { uType: 'mod' });
-
+
}
exports.requiredData = ['nick'];
@@ -59,5 +59,5 @@ exports.requiredData = ['nick'];
exports.info = {
name: 'dumb',
usage: 'dumb {nick} [allies...]',
- description: 'Cleanly disable a user messages and make him dumb'
+ description: 'Globally shadow mute a connection. Optional allies array will see muted messages.'
};
diff --git a/server/src/commands/mod/speak.js b/server/src/commands/mod/speak.js
index 422ad2c..643280b 100644
--- a/server/src/commands/mod/speak.js
+++ b/server/src/commands/mod/speak.js
@@ -1,9 +1,8 @@
-/*
+/*
* Description: Pardon a dumb user to be able to speak again
* Author: simple
*/
-
exports.run = async (core, server, socket, data) => {
if (socket.uType == 'user') {
// ignore if not mod or admin
@@ -18,7 +17,7 @@ exports.run = async (core, server, socket, data) => {
return;
}
-
+
let target;
if (typeof data.ip === 'string') {
@@ -26,14 +25,14 @@ exports.run = async (core, server, socket, data) => {
} else {
target = data.hash;
}
-
+
delete core.muzzledHashes[target];
-
+
server.broadcast({
cmd: 'info',
text: `${socket.nick} unmuzzled : ${target}`
}, { uType: 'mod' });
-
+
}
exports.info = {