let them chat! (spectators)

This commit is contained in:
legop3
2025-11-25 02:04:25 -05:00
parent c7380e30fd
commit 22c4c7110d
2 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -75,10 +75,10 @@ function broadcastMessage(message) {
function handleIncoming({ text } = {}, socket, cb = () => {}) {
const role = getRole(socket);
if (role === 'spectator') {
cb({ error: 'Spectators cannot chat' });
return;
}
// if (role === 'spectator') {
// cb({ error: 'Spectators cannot chat' });
// return;
// }
const clean = typeof text === 'string' ? text.trim() : '';
if (!clean) {
cb({ error: 'Message required' });
+3 -3
View File
@@ -19,9 +19,9 @@ function getNickname(socket) {
function setNickname(socket, nickname) {
if (!socket) return null;
const role = getRole(socket);
if (role === 'spectator') {
throw new Error('Spectators cannot set nicknames');
}
// if (role === 'spectator') {
// throw new Error('Spectators cannot set nicknames');
// }
const value = sanitizeNickname(nickname);
if (!value) {
throw new Error('Nickname required');