From 6bf49e25aa9e2297aa886491ae2d98ceccdccc67 Mon Sep 17 00:00:00 2001 From: fumiichan <35658068+fumiichan@users.noreply.github.com> Date: Fri, 31 Jan 2025 23:18:41 +0900 Subject: [PATCH] Fix: fix detection for attachments again --- src/plugins/hideAttachments/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/hideAttachments/index.tsx b/src/plugins/hideAttachments/index.tsx index bc98b5bb4..3bbff69c2 100644 --- a/src/plugins/hideAttachments/index.tsx +++ b/src/plugins/hideAttachments/index.tsx @@ -22,6 +22,7 @@ import { ImageInvisible, ImageVisible } from "@components/Icons"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { ChannelStore } from "@webpack/common"; +import { MessageSnapshot } from "@webpack/types"; import { ILoadMessagesSuccessPayload, IMessage, IMessageCreatePayload, IMessageUpdatePayload } from "./types"; import { isStringEmpty } from "./utils"; @@ -182,8 +183,11 @@ export default definePlugin({ settings, - renderMessagePopoverButton(msg: IMessage) { - const hasAttachmentsInSnapshots = !Array.isArray(msg.message_snapshots); + renderMessagePopoverButton(msg) { + // @ts-ignore - discord-types lags behind discord. + const hasAttachmentsInSnapshots = msg.messageSnapshots.some( + (snapshot: MessageSnapshot) => snapshot?.message.attachments.length || snapshot?.message.embeds.length > 0 + ); if (!msg.attachments.length && !msg.embeds.length && !msg.stickerItems.length && !hasAttachmentsInSnapshots) { return null; }