Plugin

UnsuppressEmbeds

Allows you to unsuppress embeds in messages

Chat Utility
index.tsx
Download

Source

src/plugins/unsuppressEmbeds/index.tsx
1/*
2 * FiveCord — a Discord client mod
3 * Copyright (c) 2025 FiveCord
4 * SPDX-License-Identifier: GPL-3.0-or-later
5 */
6
7import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
8import { ImageInvisible, ImageVisible } from "@components/Icons";
9import { Devs } from "@utils/constants";
10import definePlugin from "@utils/types";
11import { Channel, Message } from "@vencord/discord-types";
12import { Constants, Menu, PermissionsBits, PermissionStore, RestAPI, UserStore } from "@webpack/common";
13
14
15const EMBED_SUPPRESSED = 1 << 2;
16
17const messageContextMenuPatch: NavContextMenuPatchCallback = (
18 children,
19 { channel, message: { author, messageSnapshots, embeds, flags, id: messageId } }: { channel: Channel; message: Message; }
20) => {
21 const isEmbedSuppressed = (flags & EMBED_SUPPRESSED) !== 0;
22 const hasEmbedsInSnapshots = messageSnapshots.some(s => s.message.embeds.length);
23
24 if (!isEmbedSuppressed && !embeds.length && !hasEmbedsInSnapshots) return;
25
26 const hasEmbedPerms = channel.isPrivate() || !!(PermissionStore.getChannelPermissions({ id: channel.id }) & PermissionsBits.EMBED_LINKS);
27 if (author.id === UserStore.getCurrentUser().id && !hasEmbedPerms) return;
28
29 const menuGroup = findGroupChildrenByChildId("delete", children);
30 const deleteIndex = menuGroup?.findIndex(i => i?.props?.id === "delete");
31 if (!deleteIndex || !menuGroup) return;
32
33 menuGroup.splice(deleteIndex - 1, 0, (
34 <Menu.MenuItem
35 id="unsuppress-embeds"
36 key="unsuppress-embeds"
37 label={isEmbedSuppressed ? "Unsuppress Embeds" : "Suppress Embeds"}
38 color={isEmbedSuppressed ? undefined : "danger"}
39 icon={isEmbedSuppressed ? ImageVisible : ImageInvisible}
40 action={() =>
41 RestAPI.patch({
42 url: Constants.Endpoints.MESSAGE(channel.id, messageId),
43 body: { flags: isEmbedSuppressed ? flags & ~EMBED_SUPPRESSED : flags | EMBED_SUPPRESSED }
44 })
45 }
46 />
47 ));
48};
49
50export default definePlugin({
51 name: "UnsuppressEmbeds",
52 authors: [Devs.rad, Devs.HypedDomi],
53 description: "Allows you to unsuppress embeds in messages",
54 tags: ["Chat", "Utility"],
55 contextMenus: {
56 "message": messageContextMenuPatch
57 }
58});
59