misc.mcserver: fix motd coloring

This commit is contained in:
Cynthia Foxwell 2024-08-02 12:20:59 -06:00
parent fcb1b770ea
commit 3bebfa762f

View file

@ -243,7 +243,7 @@ mcserver.callback = async function (msg, line) {
typeof data.description == "string" typeof data.description == "string"
? data.description ? data.description
: data.description?.text ?? "<server didn't properly send motd>"; : data.description?.text ?? "<server didn't properly send motd>";
const motd = desc.replace(/\u00a7([a-f0-9k-or])/gi, (formatting) => { const motd = desc.replace(/\u00a7([a-f0-9k-or])/gi, (_, formatting) => {
const ansi = formattingToAnsi[formatting]; const ansi = formattingToAnsi[formatting];
return ansi ? `\x1b[${ansi}m` : ""; return ansi ? `\x1b[${ansi}m` : "";
}); });