diff options
author | OpSimple <35542206+OpSimple@users.noreply.github.com> | 2018-05-31 21:42:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-31 21:42:54 +0200 |
commit | c615992efa0529de28d386b981d76ef5eb504e53 (patch) | |
tree | f9c3fe873a8e7e982438908274c67223b4412d3e /server | |
parent | Added hashes into each socket (diff) | |
download | hackchat-c615992efa0529de28d386b981d76ef5eb504e53.tar.gz hackchat-c615992efa0529de28d386b981d76ef5eb504e53.zip |
Created dumb.js
This command module adds a new way to cleanly get rid of unwanted spams.
Diffstat (limited to 'server')
-rw-r--r-- | server/src/commands/mod/dumb.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/server/src/commands/mod/dumb.js b/server/src/commands/mod/dumb.js new file mode 100644 index 0000000..19d9b68 --- /dev/null +++ b/server/src/commands/mod/dumb.js @@ -0,0 +1,58 @@ +/* + * Description: Make a user (spammer) dumb + * Author: simple + */ + +exports.init = (core) => { + core.muzzledHashes = {}; +} + +exports.run = async (core, server, socket, data) => { + if (socket.uType == 'user') { + // ignore if not mod or admin + return; + } + + if (typeof data.nick !== 'string') { + return; + } + + let targetNick = data.nick; + let badClient = server.findSockets({ channel: socket.channel, nick: targetNick }); + + if (badClient.length === 0) { + server.reply({ + cmd: 'warn', + text: 'Could not find user in channel' + }, socket); + + return; + } + + badClient = badClient[0]; + + if (badClient.uType !== 'user') { + server.reply({ + cmd: 'warn', + text: 'This trick wont work on mods and admin' + }, socket); + + return; + } + + core.muzzledHashes[badClient.hash] = true; + + server.broadcast({ + cmd: 'info', + text: `${socket.nick} muzzled ${targetNick} in ${socket.channel}, userhash: ${badClient.hash}` + }, { uType: 'mod' }); + +} + +exports.requiredData = ['nick']; + +exports.info = { + name: 'dumb', + usage: 'dumb {nick}', + description: 'Cleanly disable a user messages and make him dumb' +}; |