/* * Vencord, a Discord client mod * Copyright (c) 2024 Vendicated and contributors * SPDX-License-Identifier: GPL-3.0-or-later */ import { definePluginSettings } from "@api/Settings"; import { getUserSettingDefinitionLazy } from "@api/UserSettingDefinitions"; import { ImageIcon } from "@components/Icons"; import { Devs } from "@utils/constants"; import { getCurrentGuild, openImageModal } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; import { findByProps } from "@webpack"; import { Clipboard, GuildStore, Menu, PermissionStore } from "@webpack/common"; const GuildSettingsActions = findByProps("open", "selectRole", "updateGuild"); const DeveloperMode = getUserSettingDefinitionLazy("appearance", "developerMode")!; function PencilIcon() { return ( ); } function AppearanceIcon() { return ( ); } const settings = definePluginSettings({ roleIconFileFormat: { type: OptionType.SELECT, description: "File format to use when viewing role icons", options: [ { label: "png", value: "png", default: true }, { label: "webp", value: "webp", }, { label: "jpg", value: "jpg" } ] } }); export default definePlugin({ name: "BetterRoleContext", description: "Adds options to copy role color / edit role / view role icon when right clicking roles in the user profile", authors: [Devs.Ven, Devs.goodbee], dependencies: ["UserSettingDefinitionsAPI"], settings, start() { // DeveloperMode needs to be enabled for the context menu to be shown DeveloperMode.updateSetting(true); }, contextMenus: { "dev-context"(children, { id }: { id: string; }) { const guild = getCurrentGuild(); if (!guild) return; const role = GuildStore.getRole(guild.id, id); if (!role) return; if (role.colorString) { children.push(