Vencord/src/plugins/serverInfo/index.tsx

39 lines
1.2 KiB
TypeScript
Raw Normal View History

/*
* Vencord, a Discord client mod
* Copyright (c) 2023 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
2024-03-07 10:06:24 +00:00
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { migratePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { Menu } from "@webpack/common";
import { Guild } from "discord-types/general";
import { openGuildInfoModal } from "./GuildInfoModal";
2024-03-07 10:06:24 +00:00
const Patch: NavContextMenuPatchCallback = (children, { guild }: { guild: Guild; }) => {
const group = findGroupChildrenByChildId("privacy", children);
group?.push(
<Menu.MenuItem
id="vc-server-info"
label="Server Info"
action={() => openGuildInfoModal(guild)}
/>
);
};
migratePluginSettings("ServerInfo", "ServerProfile"); // what was I thinking with this name lmao
export default definePlugin({
name: "ServerInfo",
description: "Allows you to view info about a server",
authors: [Devs.Ven, Devs.Nuckyz],
tags: ["guild", "info", "ServerProfile"],
2024-03-07 10:06:24 +00:00
contextMenus: {
"guild-context": Patch,
"guild-header-popout": Patch
}
});