Question:
So I have an array of muted users. The users should not be able to speak if muted. I made it so if you chat (on my website) but you do /mute
the user is muted, thus they shall not speak. I tried to mute “suscat” which is my alt. It couldn’t talk if I manually typed the name in muted
but the command itself did nothing. I would like to know if the command doesn’t do anything because it doesn’t persist.
Repl link:
The link: talkrn.doxr.repl.co
let muted = ['CoderElijah', 'amasad'];
form.addEventListener('submit', function(e) {
e.preventDefault();
if (input.value && input.value !== " " && input.value !== " " && input.value !== " ") {
if (input.value.slice(0, 5) === "/mute" && username === owner) {
let banned = input.value.slice(5);
muted.push(banned);
input.value = '';
} else if (!muted.includes(username)) {
const filteredInput = filterSwearWords(input.value);
socket.emit('chat message', /* styling for the message + the actual message*/);
input.value = '';
} else {
input.value = '';
}
}
}); /* I realize that I might have to many curly brackets */