aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorOpSimple <35542206+OpSimple@users.noreply.github.com>2018-05-31 21:45:45 +0200
committerGitHub <noreply@github.com>2018-05-31 21:45:45 +0200
commitbf2d064679e2253868a3e321548337a8d3065726 (patch)
tree3766287aa81d75b2cf60afb05e79fe4b702adb86 /server/src
parentCreated dumb.js (diff)
downloadhackchat-bf2d064679e2253868a3e321548337a8d3065726.tar.gz
hackchat-bf2d064679e2253868a3e321548337a8d3065726.zip
Created speak.js
Diffstat (limited to '')
-rw-r--r--server/src/commands/mod/speak.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/server/src/commands/mod/speak.js b/server/src/commands/mod/speak.js
new file mode 100644
index 0000000..422ad2c
--- /dev/null
+++ b/server/src/commands/mod/speak.js
@@ -0,0 +1,43 @@
+/*
+ * 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
+ return;
+ }
+
+ if (typeof data.ip !== 'string' && typeof data.hash !== 'string') {
+ server.reply({
+ cmd: 'warn',
+ text: "hash:'targethash' or ip:'1.2.3.4' is required"
+ }, socket);
+
+ return;
+ }
+
+ let target;
+
+ if (typeof data.ip === 'string') {
+ target = getSocketHash(data.ip);
+ } else {
+ target = data.hash;
+ }
+
+ delete core.muzzledHashes[target];
+
+ server.broadcast({
+ cmd: 'info',
+ text: `${socket.nick} unmuzzled : ${target}`
+ }, { uType: 'mod' });
+
+}
+
+exports.info = {
+ name: 'speak',
+ usage: 'speak {[ip || hash]}',
+ description: 'Pardon a dumb user to be able to speak again'
+};