HideAttachments, UnsupressEmbeds: Work with forwarded messages (#2928)

This commit is contained in:
jamesbt365 2025-01-24 23:56:39 +00:00 committed by GitHub
parent 7ee70e831a
commit 79cbfe96c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 4 deletions

View file

@ -21,6 +21,7 @@ import { ImageInvisible, ImageVisible } from "@components/Icons";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { ChannelStore } from "@webpack/common";
import { MessageSnapshot } from "@webpack/types";
let style: HTMLStyleElement;
@ -39,7 +40,12 @@ export default definePlugin({
authors: [Devs.Ven],
renderMessagePopoverButton(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: MessageSnapshot) => snapshot?.message.attachments.length
);
if (!msg.attachments.length && !msg.embeds.length && !msg.stickerItems.length && !hasAttachmentsInShapshots) return null;
const isHidden = hiddenMessages.has(msg.id);