Fix MOTD display to actually only trim new lines

This commit is contained in:
Pavel Djundik 2018-07-16 20:54:47 +03:00
parent 056a38caeb
commit 5209b12d44

View File

@ -112,7 +112,10 @@ function buildChatMessage(msg) {
} }
// Remove empty lines around the MOTD (but not within it) // Remove empty lines around the MOTD (but not within it)
msg.text = lines.join("\n").trim(); msg.text = lines
.map((line) => line.trimEnd())
.join("\n")
.replace(/^[\r\n]+|[\r\n]+$/g, "");
} }
const renderedMessage = $(templates[template](msg)); const renderedMessage = $(templates[template](msg));