From cc5dd22b825eb4cfba136b01e0ab5b1d2334d094 Mon Sep 17 00:00:00 2001 From: Nuno Duque Nunes Date: Fri, 12 Jun 2026 16:31:38 +0100 Subject: [PATCH] fix subcommands/updates.ts namespace missing --- src/subcommands/admin/updates.ts | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/subcommands/admin/updates.ts b/src/subcommands/admin/updates.ts index e77bc1e..86e0fdc 100644 --- a/src/subcommands/admin/updates.ts +++ b/src/subcommands/admin/updates.ts @@ -1,18 +1,18 @@ import { ChatInputCommandInteraction } from "discord.js"; import { Updates } from "@systems/updates"; import { Discord } from "@discord"; - + export async function handleUpdatesPost(interaction: ChatInputCommandInteraction): Promise { await Discord.Interaction.deferReply(interaction, { ephemeral: true }); - + const opts = Discord.Interaction.options(interaction); const version = opts.string({ key: "version" }) ?? Updates.latest(); - + if (!version) { await Discord.Interaction.editReply(interaction, "❌ No versions found."); return; } - + try { await Updates.post({ version, client: interaction.client }); await Discord.Interaction.editReply(interaction, `✅ Update \`${version}\` posted.`); @@ -20,21 +20,21 @@ export async function handleUpdatesPost(interaction: ChatInputCommandInteraction await Discord.Interaction.editReply(interaction, `❌ Failed: ${err.message}`); } } - + export async function handleUpdatesPreview(interaction: ChatInputCommandInteraction): Promise { await Discord.Interaction.deferReply(interaction, { ephemeral: true }); - + const opts = Discord.Interaction.options(interaction); const version = opts.string({ key: "version" }) ?? Updates.latest(); - + if (!version) { await Discord.Interaction.editReply(interaction, "❌ No versions found."); return; } - + await Updates.preview({ version, interaction }); } - + export async function handleUpdatesList(interaction: ChatInputCommandInteraction): Promise { const versions = Updates.list(); const latest = Updates.latest(); @@ -43,13 +43,13 @@ export async function handleUpdatesList(interaction: ChatInputCommandInteraction const tag = v === latest ? " ← latest" : ""; return `⬜ \`${v}\` — ${entry?.title ?? ""}${tag}`; }); - + await Discord.Interaction.reply(interaction, { content: lines.length > 0 ? lines.join("\n") : "No versions found.", ephemeral: true, }); } - + export async function autocompleteVersion(interaction: any): Promise { const focused = interaction.options.getFocused().toLowerCase(); const versions = Updates.list(); @@ -61,4 +61,11 @@ export async function autocompleteVersion(interaction: any): Promise { }) .slice(0, 25); await interaction.respond(choices); -} \ No newline at end of file +} + +export const UpdatesCommands = { + post: handleUpdatesPost, + preview: handleUpdatesPreview, + list: handleUpdatesList, + autocomplete: autocompleteVersion, +}; \ No newline at end of file