From 4a406457a7b6928319bb2c766b8028bca164032a Mon Sep 17 00:00:00 2001 From: YashRaj <91825864+YashRajCodes@users.noreply.github.com> Date: Wed, 25 Feb 2026 19:17:32 +0530 Subject: [PATCH] feat(hideMessages): add a plugin to hide messages temporarily (#833) * feat(hideMessages): add a plugin to hide messages temporarily * refactor(hideMessages): remove redundant async * feat(hideMessages): add settings to control visibility of the hide button in message popover --------- Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com> --- src/equicordplugins/hideMessages/index.tsx | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/equicordplugins/hideMessages/index.tsx diff --git a/src/equicordplugins/hideMessages/index.tsx b/src/equicordplugins/hideMessages/index.tsx new file mode 100644 index 000000000..ca5feb6bd --- /dev/null +++ b/src/equicordplugins/hideMessages/index.tsx @@ -0,0 +1,70 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2026 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu"; +import { definePluginSettings } from "@api/Settings"; +import { EquicordDevs } from "@utils/constants"; +import definePlugin, { IconComponent, OptionType } from "@utils/types"; +import { Message } from "@vencord/discord-types"; +import { findExportedComponentLazy } from "@webpack"; +import { ChannelStore, FluxDispatcher, Menu } from "@webpack/common"; + +const EyeIconLazy = findExportedComponentLazy("EyeIcon"); +const EyeIcon: IconComponent = props => ; + +const hideMessage = (messageId: string, channelId: string) => { + FluxDispatcher.dispatch({ + type: "MESSAGE_DELETE", + id: messageId, + channelId, + mlDeleted: true, + }); +}; + +const messageCtxPatch: NavContextMenuPatchCallback = (children, { message }: { message: Message; }) => { + const group = findGroupChildrenByChildId("copy-text", children); + if (!group) return; + + group.splice(group.findIndex(c => c?.props?.id === "copy-text") + 1, 0, ( + hideMessage(message.id, message.channel_id)} + /> + )); +}; + +const settings = definePluginSettings({ + hidePopoverButton: { + type: OptionType.BOOLEAN, + description: "Hide the hide button in the message popover.", + default: false + } +}); + +export default definePlugin({ + name: "HideMessages", + description: "A plugin to temporarily hide messages until you restart.", + authors: [EquicordDevs.yash], + contextMenus: { + "message": messageCtxPatch + }, + settings, + messagePopoverButton: { + icon: EyeIcon, + render(message: Message) { + if (settings.store.hidePopoverButton) return null; + return { + label: "Hide", + icon: EyeIcon, + message, + channel: ChannelStore.getChannel(message.channel_id), + onClick: () => hideMessage(message.id, message.channel_id) + }; + } + } +});