From b616b6a02ab4e2bae11d8620d98df03d6e98cb63 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Wed, 23 Dec 2020 02:37:08 +0200 Subject: [PATCH] starboard: don't include image link when discord hides it --- backend/src/plugins/Starboard/util/saveMessageToStarboard.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/src/plugins/Starboard/util/saveMessageToStarboard.ts b/backend/src/plugins/Starboard/util/saveMessageToStarboard.ts index bdd9339b..5d67307b 100644 --- a/backend/src/plugins/Starboard/util/saveMessageToStarboard.ts +++ b/backend/src/plugins/Starboard/util/saveMessageToStarboard.ts @@ -28,7 +28,9 @@ export async function saveMessageToStarboard( embed.author.icon_url = msg.author.avatarURL; } - if (msg.content) { + // The second condition here checks for messages with only an image link that is then embedded. + // The message content in that case is hidden by the Discord client, so we hide it here too. + if (msg.content && msg.embeds[0]?.thumbnail?.url !== msg.content) { embed.description = msg.content; }