From d86023e8fd71f245e88c09f2aefcd63ab573ea91 Mon Sep 17 00:00:00 2001 From: jamesbt365 Date: Tue, 8 Oct 2024 14:29:45 +0100 Subject: [PATCH] Fix HideAttachments when message is forwarded --- src/plugins/hideAttachments/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/hideAttachments/index.tsx b/src/plugins/hideAttachments/index.tsx index fe7f4ab92..3903e1f40 100644 --- a/src/plugins/hideAttachments/index.tsx +++ b/src/plugins/hideAttachments/index.tsx @@ -49,7 +49,12 @@ export default definePlugin({ await this.buildCss(); addButton("HideAttachments", msg => { - if (!msg.attachments.length && !msg.embeds.length && !msg.stickerItems.length) return null; + // @ts-ignore - discord-types lags behind discord. + const hasAttachmentsInShapshots = msg.messageSnapshots.some( + (snapshot: { message: { attachments: any[]; }; }) => snapshot?.message.attachments.length + ); + + if (!msg.attachments.length && !msg.embeds.length && !msg.stickerItems.length && !hasAttachmentsInShapshots) return null; const isHidden = hiddenMessages.has(msg.id);