This commit is contained in:
Isaac 2024-09-19 09:37:09 +00:00 committed by GitHub
commit 8f7227f9ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 51 additions and 0 deletions

View file

@ -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 <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-labelledby="eyeCrossedIconTitle" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" stroke-linejoin="miter" fill="none" color="currentColor">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier">
<path d="M22 12C22 12 19 18 12 18C5 18 2 12 2 12C2 12 5 6 12 6C19 6 22 12 22 12Z"></path><circle cx="12" cy="12" r="3"></circle><path d="M3 21L20 4"></path></g>
</svg>;
};
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");
},
});

View file

@ -575,6 +575,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "RamziAH", name: "RamziAH",
id: 1279957227612147747n, id: 1279957227612147747n,
}, },
Isaac: {
name: "Isaac-zsh",
id: 407527870110629888n,
},
} satisfies Record<string, Dev>); } satisfies Record<string, Dev>);
// iife so #__PURE__ works correctly // iife so #__PURE__ works correctly