aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/commands/core/chat.js
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2018-06-01 21:50:38 +0200
committerGitHub <noreply@github.com>2018-06-01 21:50:38 +0200
commit71e940ddbae9b08c542ed7873d5adfaf51f28cd1 (patch)
tree3517a08cf3ab1a6adc81f3eadeff476b9dc931a9 /server/src/commands/core/chat.js
parentformatting fix (diff)
parentArray checking made constructor safe (diff)
downloadhackchat-71e940ddbae9b08c542ed7873d5adfaf51f28cd1.tar.gz
hackchat-71e940ddbae9b08c542ed7873d5adfaf51f28cd1.zip
Merge pull request #16 from OpSimple/master
A new way to handle the spammers
Diffstat (limited to '')
-rw-r--r--server/src/commands/core/chat.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/server/src/commands/core/chat.js b/server/src/commands/core/chat.js
index bce6adb..80241d5 100644
--- a/server/src/commands/core/chat.js
+++ b/server/src/commands/core/chat.js
@@ -48,7 +48,15 @@ exports.run = async (core, server, socket, data) => {
payload.trip = socket.trip;
}
- server.broadcast( payload, { channel: socket.channel });
+ if(core.muzzledHashes && core.muzzledHashes[socket.hash]){
+ server.broadcast( payload, { channel: socket.channel, hash: socket.hash });
+ if(core.muzzledHashes[socket.hash].allies){
+ server.broadcast( payload, { channel: socket.channel, nick: core.muzzledHashes[socket.hash].allies });
+ }
+ } else {
+ //else send it to everyone
+ server.broadcast( payload, { channel: socket.channel});
+ }
core.managers.stats.increment('messages-sent');
};
@@ -59,4 +67,4 @@ exports.info = {
name: 'chat',
usage: 'chat {text}',
description: 'Broadcasts passed `text` field to the calling users channel'
-}; \ No newline at end of file
+};