diff options
author | V <vendicated@riseup.net> | 2023-09-05 18:34:12 +0200 |
---|---|---|
committer | V <vendicated@riseup.net> | 2023-09-05 18:36:14 +0200 |
commit | 2c758ccdf8372c48f2d2a79ece8f2eba63f1510c (patch) | |
tree | dfd63397b054a2c3ab48550109dfc75a4c7b38f3 /src/plugins/serverProfile/index.tsx | |
parent | c165725297a9e8aadea15cb22957db38b37c4515 (diff) | |
download | Vencord-2c758ccdf8372c48f2d2a79ece8f2eba63f1510c.tar.gz Vencord-2c758ccdf8372c48f2d2a79ece8f2eba63f1510c.tar.bz2 Vencord-2c758ccdf8372c48f2d2a79ece8f2eba63f1510c.zip |
new plugin: ServerProfile (#1704)
Co-authored-by: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Diffstat (limited to 'src/plugins/serverProfile/index.tsx')
-rw-r--r-- | src/plugins/serverProfile/index.tsx | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/plugins/serverProfile/index.tsx b/src/plugins/serverProfile/index.tsx new file mode 100644 index 0000000..c27f8cd --- /dev/null +++ b/src/plugins/serverProfile/index.tsx @@ -0,0 +1,40 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2023 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +import { addContextMenuPatch, findGroupChildrenByChildId, NavContextMenuPatchCallback, removeContextMenuPatch } from "@api/ContextMenu"; +import { Devs } from "@utils/constants"; +import definePlugin from "@utils/types"; +import { Menu } from "@webpack/common"; +import { Guild } from "discord-types/general"; + +import { openGuildProfileModal } from "./GuildProfileModal"; + +const Patch: NavContextMenuPatchCallback = (children, { guild }: { guild: Guild; }) => () => { + const group = findGroupChildrenByChildId("privacy", children); + + group?.push( + <Menu.MenuItem + id="vc-server-profile" + label="Server Profile" + action={() => openGuildProfileModal(guild)} + /> + ); +}; + +export default definePlugin({ + name: "ServerProfile", + description: "Allows you to view info about a server by right clicking it in the server list", + authors: [Devs.Ven, Devs.Nuckyz], + tags: ["guild", "info"], + + start() { + addContextMenuPatch(["guild-context", "guild-header-popout"], Patch); + }, + + stop() { + removeContextMenuPatch(["guild-context", "guild-header-popout"], Patch); + } +}); |