From fcb1b770ea45e0284bb3569f8c5d17843f6153fb Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Fri, 2 Aug 2024 12:17:51 -0600 Subject: [PATCH] misc.mcserver: fix motd for some (older) servers --- src/modules/misc/mcserver.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/modules/misc/mcserver.js b/src/modules/misc/mcserver.js index b84ee32..8594516 100644 --- a/src/modules/misc/mcserver.js +++ b/src/modules/misc/mcserver.js @@ -239,7 +239,11 @@ mcserver.callback = async function (msg, line) { await msg.removeReaction("\uD83C\uDFD3"); - const motd = data.description.text.replace(/\u00a7([a-f0-9k-or])/gi, (formatting) => { + const desc = + typeof data.description == "string" + ? data.description + : data.description?.text ?? ""; + const motd = desc.replace(/\u00a7([a-f0-9k-or])/gi, (formatting) => { const ansi = formattingToAnsi[formatting]; return ansi ? `\x1b[${ansi}m` : ""; });