From 65c5897dc364d716fb48e7e0d1964ce3730e121e Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 18 Sep 2024 01:26:25 +0200 Subject: [PATCH] remove need to depend on CommandsAPI --- src/components/PluginSettings/index.tsx | 4 ++-- src/plugins/_core/supportHelper.tsx | 2 +- src/plugins/friendInvites/index.ts | 1 - src/plugins/index.ts | 5 +++++ src/plugins/messageTags/index.ts | 1 - src/plugins/moreCommands/index.ts | 1 - src/plugins/moreKaomoji/index.ts | 1 - src/plugins/petpet/index.ts | 1 - src/plugins/silentTyping/index.tsx | 2 +- src/plugins/spotifyShareCommands/index.ts | 1 - src/utils/types.ts | 4 ++-- src/webpack/common/types/components.d.ts | 2 +- 12 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/PluginSettings/index.tsx b/src/components/PluginSettings/index.tsx index 38ddc4a9..c3b6e908 100644 --- a/src/components/PluginSettings/index.tsx +++ b/src/components/PluginSettings/index.tsx @@ -292,10 +292,10 @@ export default function PluginSettings() { if (!pluginFilter(p)) continue; - const isRequired = p.required || depMap[p.name]?.some(d => settings.plugins[d].enabled); + const isRequired = p.required || p.isDependency || depMap[p.name]?.some(d => settings.plugins[d].enabled); if (isRequired) { - const tooltipText = p.required + const tooltipText = p.required || !depMap[p.name] ? "This plugin is required for Vencord to function." : makeDependencyList(depMap[p.name]?.filter(d => settings.plugins[d].enabled)); diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index de8e37c7..432896fc 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -142,7 +142,7 @@ export default definePlugin({ required: true, description: "Helps us provide support to you", authors: [Devs.Ven], - dependencies: ["CommandsAPI", "UserSettingsAPI", "MessageAccessoriesAPI"], + dependencies: ["UserSettingsAPI", "MessageAccessoriesAPI"], settings, diff --git a/src/plugins/friendInvites/index.ts b/src/plugins/friendInvites/index.ts index 20c615d6..3c5a324f 100644 --- a/src/plugins/friendInvites/index.ts +++ b/src/plugins/friendInvites/index.ts @@ -27,7 +27,6 @@ export default definePlugin({ name: "FriendInvites", description: "Create and manage friend invite links via slash commands (/create friend invite, /view friend invites, /revoke friend invites).", authors: [Devs.afn, Devs.Dziurwa], - dependencies: ["CommandsAPI"], commands: [ { name: "create friend invite", diff --git a/src/plugins/index.ts b/src/plugins/index.ts index ac6821a6..129e42a0 100644 --- a/src/plugins/index.ts +++ b/src/plugins/index.ts @@ -105,6 +105,11 @@ for (const p of pluginsValues) if (isPluginEnabled(p.name)) { settings[d].enabled = true; dep.isDependency = true; }); + + if (p.commands?.length) { + Plugins.CommandsAPI.isDependency = true; + settings.CommandsAPI.enabled = true; + } } for (const p of pluginsValues) { diff --git a/src/plugins/messageTags/index.ts b/src/plugins/messageTags/index.ts index 66de9d66..5ba4ab94 100644 --- a/src/plugins/messageTags/index.ts +++ b/src/plugins/messageTags/index.ts @@ -82,7 +82,6 @@ export default definePlugin({ default: true } }, - dependencies: ["CommandsAPI"], async start() { for (const tag of await getTags()) createTagCommand(tag); diff --git a/src/plugins/moreCommands/index.ts b/src/plugins/moreCommands/index.ts index 61312acc..02f3c373 100644 --- a/src/plugins/moreCommands/index.ts +++ b/src/plugins/moreCommands/index.ts @@ -33,7 +33,6 @@ export default definePlugin({ name: "MoreCommands", description: "echo, lenny, mock", authors: [Devs.Arjix, Devs.echo, Devs.Samu], - dependencies: ["CommandsAPI"], commands: [ { name: "echo", diff --git a/src/plugins/moreKaomoji/index.ts b/src/plugins/moreKaomoji/index.ts index b5e33d96..9a691fc4 100644 --- a/src/plugins/moreKaomoji/index.ts +++ b/src/plugins/moreKaomoji/index.ts @@ -24,7 +24,6 @@ export default definePlugin({ name: "MoreKaomoji", description: "Adds more Kaomoji to discord. ヽ(´▽`)/", authors: [Devs.JacobTm], - dependencies: ["CommandsAPI"], commands: [ { name: "dissatisfaction", description: " >﹏<" }, { name: "smug", description: "ಠ_ಠ" }, diff --git a/src/plugins/petpet/index.ts b/src/plugins/petpet/index.ts index 2e06d0b1..708c6f0c 100644 --- a/src/plugins/petpet/index.ts +++ b/src/plugins/petpet/index.ts @@ -88,7 +88,6 @@ export default definePlugin({ name: "petpet", description: "Adds a /petpet slash command to create headpet gifs from any image", authors: [Devs.Ven], - dependencies: ["CommandsAPI"], commands: [ { inputType: ApplicationCommandInputType.BUILT_IN, diff --git a/src/plugins/silentTyping/index.tsx b/src/plugins/silentTyping/index.tsx index 2a6a6428..ad28999a 100644 --- a/src/plugins/silentTyping/index.tsx +++ b/src/plugins/silentTyping/index.tsx @@ -88,7 +88,7 @@ export default definePlugin({ name: "SilentTyping", authors: [Devs.Ven, Devs.Rini, Devs.ImBanana], description: "Hide that you are typing", - dependencies: ["CommandsAPI", "ChatInputButtonAPI"], + dependencies: ["ChatInputButtonAPI"], settings, contextMenus: { "textarea-context": ChatBarContextCheckbox diff --git a/src/plugins/spotifyShareCommands/index.ts b/src/plugins/spotifyShareCommands/index.ts index a3b82dc2..8c485666 100644 --- a/src/plugins/spotifyShareCommands/index.ts +++ b/src/plugins/spotifyShareCommands/index.ts @@ -76,7 +76,6 @@ export default definePlugin({ name: "SpotifyShareCommands", description: "Share your current Spotify track, album or artist via slash command (/track, /album, /artist)", authors: [Devs.katlyn], - dependencies: ["CommandsAPI"], commands: [ { name: "track", diff --git a/src/utils/types.ts b/src/utils/types.ts index e5486e9a..dd3c1157 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -72,13 +72,13 @@ export interface PluginDef { stop?(): void; patches?: Omit[]; /** - * List of commands. If you specify these, you must add CommandsAPI to dependencies + * List of commands that your plugin wants to register */ commands?: Command[]; /** * A list of other plugins that your plugin depends on. * These will automatically be enabled and loaded before your plugin - * Common examples are CommandsAPI, MessageEventsAPI... + * Generally these will be API plugins */ dependencies?: string[], /** diff --git a/src/webpack/common/types/components.d.ts b/src/webpack/common/types/components.d.ts index 6c762333..e493e295 100644 --- a/src/webpack/common/types/components.d.ts +++ b/src/webpack/common/types/components.d.ts @@ -69,7 +69,7 @@ export type FormText = ComponentType & TextProps> & { Types: FormTextTypes; }; export type Tooltip = ComponentType<{ - text: ReactNode; + text: ReactNode | ComponentType; children: FunctionComponent<{ onClick(): void; onMouseEnter(): void;