From 78c9999e974ffdece13fad19ed72e09de06c8752 Mon Sep 17 00:00:00 2001 From: OTKUSteyler <90369564+OTKUSteyler@users.noreply.github.com> Date: Wed, 10 Dec 2025 17:24:22 +0100 Subject: [PATCH] Delete commands directory --- commands/debug.ts | 41 --------- commands/eval.ts | 43 ---------- commands/plugins.ts | 199 -------------------------------------------- commands/reload.ts | 13 --- 4 files changed, 296 deletions(-) delete mode 100644 commands/debug.ts delete mode 100644 commands/eval.ts delete mode 100644 commands/plugins.ts delete mode 100644 commands/reload.ts diff --git a/commands/debug.ts b/commands/debug.ts deleted file mode 100644 index f77b433..0000000 --- a/commands/debug.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { Strings } from "@core/i18n"; -import { - ApplicationCommand, - ApplicationCommandOptionType, -} from "@lib/api/commands/types"; -import { getDebugInfo } from "@lib/api/debug"; -import { messageUtil } from "@metro/common"; - -export default () => - { - name: "Goon", - description: Strings.COMMAND_DEBUG_DESC, - options: [ - { - name: "ephemeral", - type: ApplicationCommandOptionType.BOOLEAN, - description: Strings.COMMAND_DEBUG_OPT_EPHEMERALLY, - }, - ], - execute([ephemeral], ctx) { - const info = getDebugInfo(); - const content = [ - "**💦GoonCord💦 Debug Info**", - `> GoonCord: ${info.bunny.version} (${info.bunny.loader.name} ${info.bunny.loader.version})`, - `> Discord: ${info.discord.version} (${info.discord.build})`, - `> React: ${info.react.version} (RN ${info.react.nativeVersion})`, - `> Hermes: ${info.hermes.version} (bcv${info.hermes.bytecodeVersion})`, - `> System: ${info.os.name} ${info.os.version} ${info.os.sdk ? `(SDK ${info.os.sdk})` : ""}`.trimEnd(), - `> Device: ${info.device.model}`, - ].join("\n"); - - if (ephemeral?.value) { - messageUtil.sendBotMessage(ctx.channel.id, content); - } else { - const fixNonce = Date.now().toString(); - messageUtil.sendMessage(ctx.channel.id, { content }, void 0, { - nonce: fixNonce, - }); - } - }, - }; diff --git a/commands/eval.ts b/commands/eval.ts deleted file mode 100644 index 0d17c85..0000000 --- a/commands/eval.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { Strings } from "@core/i18n"; -import { ApplicationCommand, ApplicationCommandOptionType } from "@lib/api/commands/types"; -import { settings } from "@lib/api/settings"; -import { messageUtil } from "@metro/common"; -import { findByPropsLazy } from "@metro/wrappers"; - -const util = findByPropsLazy("inspect"); -const AsyncFunction = (async () => void 0).constructor; - -const ZERO_WIDTH_SPACE_CHARACTER = "\u200B"; - -function wrapInJSCodeblock(resString: string) { - return "```js\n" + resString.replaceAll("`", "`" + ZERO_WIDTH_SPACE_CHARACTER) + "\n```"; -} - -export default () => { - name: "eval", - description: Strings.COMMAND_EVAL_DESC, - shouldHide: () => settings.enableEvalCommand === true, - options: [ - { - name: "code", - type: ApplicationCommandOptionType.STRING, - description: Strings.COMMAND_EVAL_OPT_CODE, - required: true - }, - { - name: "async", - type: ApplicationCommandOptionType.BOOLEAN, - description: Strings.COMMAND_EVAL_OPT_ASYNC, - } - ], - async execute([code, async], ctx) { - try { - const res = util.inspect(async?.value ? await AsyncFunction(code.value)() : eval?.(code.value)); - const trimmedRes = res.length > 2000 ? res.slice(0, 2000) + "..." : res; - - messageUtil.sendBotMessage(ctx.channel.id, wrapInJSCodeblock(trimmedRes)); - } catch (err: any) { - messageUtil.sendBotMessage(ctx.channel.id, wrapInJSCodeblock(err?.stack ?? err)); - } - } -}; diff --git a/commands/plugins.ts b/commands/plugins.ts deleted file mode 100644 index b83f6a7..0000000 --- a/commands/plugins.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { Strings } from "@core/i18n"; -import { - ApplicationCommand, - ApplicationCommandOptionType, -} from "@lib/api/commands/types"; -import { messageUtil } from "@metro/common"; -import { VdPluginManager, VendettaPlugin } from "@core/vendetta/plugins"; -import { - registeredPlugins, - corePluginInstances, - pluginSettings, -} from "@lib/addons/plugins"; - -/** - * /plugins - * - * Aggregates: - * - Core plugins (built-in) from corePluginInstances - * - External plugins: - * - Vendetta-managed plugins (VdPluginManager.plugins) - * - Bunny repository plugins (registeredPlugins + pluginSettings) - * - * Dedupes by plugin id and shows Enabled / Disabled groups. - * For external plugins each entry will show its source(s) (vendetta / bunny). - */ -export default () => - { - name: "plugins", - description: Strings.COMMAND_PLUGINS_DESC, - options: [ - { - name: "ephemeral", - displayName: "ephemeral", - type: ApplicationCommandOptionType.BOOLEAN, - description: Strings.COMMAND_DEBUG_OPT_EPHEMERALLY, - }, - ], - execute([ephemeral], ctx) { - // --- Core plugins --- - const coreIds = [...corePluginInstances.keys()]; - - const coreManifests = coreIds - .map((id) => registeredPlugins.get(id)) - .filter(Boolean) as any[]; - - const coreEnabled = coreManifests - .filter((m) => Boolean(pluginSettings[m.id]?.enabled)) - .map((m) => m.display?.name ?? m.name ?? m.id) - .sort((a, b) => a.localeCompare(b)); - const coreDisabled = coreManifests - .filter((m) => !Boolean(pluginSettings[m.id]?.enabled)) - .map((m) => m.display?.name ?? m.name ?? m.id) - .sort((a, b) => a.localeCompare(b)); - - // --- External plugins aggregation (Vendetta + Bunny) --- - type ExtEntry = { - id: string; - name: string; - sources: Set; - enabled: boolean; // overall enabled if any source reports enabled (Vendetta) or pluginSettings for Bunny - }; - - const aggregated = new Map(); - - // Vendetta plugins (if available) - try { - const vdRaw = - (VdPluginManager && (VdPluginManager as any).plugins) || {}; - const vdPlugins = Object.values(vdRaw).filter( - Boolean, - ) as VendettaPlugin[]; - - for (const p of vdPlugins) { - const id = - p.manifest?.id ?? p.id ?? String(p.manifest?.name ?? Math.random()); - const name = p.manifest?.name ?? id; - const enabled = Boolean(p.enabled); - const existing = aggregated.get(id); - if (existing) { - existing.sources.add("vendetta"); - existing.enabled = existing.enabled || enabled; - } else { - aggregated.set(id, { - id, - name, - sources: new Set(["vendetta"]), - enabled, - }); - } - } - } catch (e) { - // Defensive: if Vendetta manager isn't ready, skip vendetta aggregation - } - - // Bunny external plugins: use registeredPlugins + pluginSettings (installed) - for (const [id, manifest] of registeredPlugins) { - if (!manifest) continue; - // External bunny plugins have parentRepository property - // Only consider those that are actual external plugins (have parentRepository) - const isExternal = (manifest as any).parentRepository != null; - if (!isExternal) continue; - - // Skip core plugin ids (safety) - if (corePluginInstances.has(id)) continue; - - const name = manifest.display?.name ?? manifest.name ?? id; - const installed = pluginSettings[id] != null; - const enabled = Boolean(pluginSettings[id]?.enabled); - - // If not installed and not present in aggregated (vendetta), still include as available but mark enabled=false - const existing = aggregated.get(id); - if (existing) { - existing.sources.add("bunny"); - existing.enabled = existing.enabled || enabled; - } else { - // Only add bunny entry if installed OR if it's registered and not installed we will handle as available later - if (installed) { - aggregated.set(id, { - id, - name, - sources: new Set(["bunny"]), - enabled, - }); - } - } - } - - // Also collect available-but-not-installed Bunny externals for the "available" list - const available = [...registeredPlugins.values()] - .filter( - (m: any) => - Boolean(m) && - (m as any).parentRepository && - !corePluginInstances.has((m as any).id), - ) - .map((m: any) => ({ - id: m.id, - name: m.display?.name ?? m.name ?? m.id, - installed: pluginSettings[m.id] != null, - })) - .filter((x) => !x.installed) - .sort((a, b) => a.name.localeCompare(b.name)) - .map((x) => x.name); - - // Build external lists (deduped) - const externalList = Array.from(aggregated.values()).sort((a, b) => - a.name.localeCompare(b.name), - ); - - const externalEnabled = externalList - .filter((e) => e.enabled) - .map((e) => e.name); - const externalDisabled = externalList - .filter((e) => !e.enabled) - .map((e) => e.name); - - // Build message - const lines: string[] = []; - - // Core plugins - lines.push(`**Plugins (${coreManifests.length}):**`); - if (coreEnabled.length > 0) { - lines.push(`Enabled (${coreEnabled.length}):`); - lines.push("> " + coreEnabled.join(", ")); - } - if (coreDisabled.length > 0) { - lines.push(`Disabled (${coreDisabled.length}):`); - lines.push("> " + coreDisabled.join(", ")); - } - if (coreManifests.length === 0) { - lines.push("_No core plugins registered._"); - } - - // External plugins - lines.push(`**External Plugins (${externalList.length}):**`); - if (externalEnabled.length > 0) { - lines.push(`Installed & Enabled (${externalEnabled.length}):`); - lines.push("> " + externalEnabled.join(", ")); - } - if (externalDisabled.length > 0) { - lines.push(`Installed & Disabled (${externalDisabled.length}):`); - lines.push("> " + externalDisabled.join(", ")); - } - if (externalList.length === 0) { - lines.push("_No external plugins found._"); - } - - const content = lines.join("\n"); - - if (ephemeral?.value) { - messageUtil.sendBotMessage(ctx.channel.id, content); - } else { - const fixNonce = Date.now().toString(); - messageUtil.sendMessage(ctx.channel.id, { content }, void 0, { - nonce: fixNonce, - }); - } - }, - }; diff --git a/commands/reload.ts b/commands/reload.ts deleted file mode 100644 index 04676d8..0000000 --- a/commands/reload.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { Strings } from "@core/i18n"; -import { ApplicationCommand } from "@lib/api/commands/types"; -import { BundleUpdaterManager } from "@lib/api/native/modules"; - -export default () => - { - name: "reload", - description: Strings.COMMAND_RELOAD_DESC, - options: [], - execute() { - BundleUpdaterManager.reload(); - }, - }; \ No newline at end of file