forked from ppfun/pixelplanet
add limit of 300 characters to chat messages
This commit is contained in:
parent
d056c8111e
commit
fdae2b76fe
|
@ -223,6 +223,9 @@ class SocketServer extends WebSocketEvents {
|
|||
if (waitLeft) {
|
||||
// eslint-disable-next-line max-len
|
||||
ws.send(JSON.stringify(['info', `You are sending messages too fast, you have to wait ${Math.floor(waitLeft / 1000)}s :(`]));
|
||||
} else if (message.length > 300) {
|
||||
// eslint-disable-next-line max-len
|
||||
ws.send(JSON.stringify(['info', 'You can\'t send a message this long :(']));
|
||||
} else {
|
||||
webSockets.broadcastChatMessage(ws.name, message);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user