Last active
October 26, 2016 16:31
-
-
Save TapGhoul/01b6fc660e538c0e6a3eaa8281f83e62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var spammedUsers = {}; | |
| setInterval(function() { | |
| for (var i in spammedUsers) { | |
| spammedUsers[i]--; | |
| if (spammedUsers[i] <= 0) | |
| delete spammedUsers[i]; | |
| } | |
| }, 2000) | |
| socket.On('ChatMessage', function(data) { | |
| if (!spammedUsers[data.displayName]) { | |
| spammedUsers[data.displayName] = 1; | |
| } else { | |
| spammedUsers[data.displayName]++; | |
| } | |
| if (data.message.length >= 180) { | |
| spammedUsers[data.displayName] += 2; | |
| } | |
| if (spammedUsers[data.displayName] > 5) { | |
| socket.Emit('NewMessage', new proto.NewMessage(["/sb " + data.displayName])); | |
| socket.Emit('NewMessage', new proto.NewMessage(["/cu " + data.displayName])); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment