stop blank messages from being sent #5

Closed
carsand101 wants to merge 3 commits from main into main
2 changed files with 846 additions and 841 deletions

View File

@ -72,9 +72,14 @@ async function sendMessage(content, id) {
messageBox.addEventListener("keyup", function onEvent(event) { messageBox.addEventListener("keyup", function onEvent(event) {
if (event.key === "Enter") { if (event.key === "Enter") {
sendMessage(messageBox.value, channelID) if (!messageBox.value.trim().length == 0) {
updateMessages(channelID) sendMessage(messageBox.value, channelID)
messageBox.value = "" updateMessages(channelID)
messageBox.value = ""
}
else {
return;
}
} }
}) })