diff --git a/src/plugins/hideMessage/index.tsx b/src/plugins/hideMessage/index.tsx new file mode 100644 index 000000000..45dac1b54 --- /dev/null +++ b/src/plugins/hideMessage/index.tsx @@ -0,0 +1,47 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { addButton, removeButton } from "@api/MessagePopover"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; +import { ChannelStore } from "@webpack/common"; +import { FluxDispatcher } from "@webpack/common"; +import { Message } from "discord-types/general"; + +const HideIcon = () => { + return + + + ; +}; + +export default definePlugin({ + name: "HideMessage", + description: "Adds an option to hide messages", + authors: [Devs.Isaac], + + hideMessage(msg: Message) { + FluxDispatcher.dispatch({type: "MESSAGE_DELETE", channelId: msg.channel_id, id: msg.id}); + }, + + start() { + addButton("HideMessage", msg => { + const label = "Hide Message"; + + return { + label, + icon: HideIcon, + message: msg, + channel: ChannelStore.getChannel(msg.channel_id), + onClick: () => this.hideMessage(msg) + }; + }); + }, + + stop() { + removeButton("HideMessage"); + }, +}); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 0572fa102..4fc52ba71 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -575,6 +575,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({ name: "RamziAH", id: 1279957227612147747n, }, + Isaac: { + name: "Isaac-zsh", + id: 407527870110629888n, + }, } satisfies Record); // iife so #__PURE__ works correctly