mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-19 22:20:34 +00:00
Merge f9a59d89e1
into f27361f017
This commit is contained in:
commit
8f7227f9ce
2 changed files with 51 additions and 0 deletions
47
src/plugins/hideMessage/index.tsx
Normal file
47
src/plugins/hideMessage/index.tsx
Normal 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");
|
||||||
|
},
|
||||||
|
});
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue