From f4bfe54850b86280c3e3d0b12108d353d6a7dc7d Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Wed, 12 Jul 2023 14:33:38 +1200 Subject: [PATCH] Include fallback text for replies to media --- d2m/converters/message-to-event.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/d2m/converters/message-to-event.js b/d2m/converters/message-to-event.js index 6705b6e..300d154 100644 --- a/d2m/converters/message-to-event.js +++ b/d2m/converters/message-to-event.js @@ -144,7 +144,9 @@ async function messageToEvent(message, guild, api) { repliedToDisplayName = message.referenced_message?.author.global_name || message.referenced_message?.author.username || "a Discord user" repliedToUserHtml = repliedToDisplayName } - const repliedToContent = message.referenced_message?.content || "[Replied-to message content wasn't provided by Discord]" + let repliedToContent = message.referenced_message?.content + if (repliedToContent == "") repliedToContent = "[Media]" + else if (!repliedToContent) repliedToContent = "[Replied-to message content wasn't provided by Discord]" const repliedToHtml = markdown.toHTML(repliedToContent, { discordCallback: getDiscordParseCallbacks(message, true) }, null, null)