import { createCommand } from "@shared/lib/utils"; import { AuroraClient } from "@/lib/BotClient"; import { SlashCommandBuilder, PermissionFlagsBits } from "discord.js"; import { createSuccessEmbed } from "@lib/embeds"; import { withCommandErrorHandling } from "@lib/commandUtils"; export const refresh = createCommand({ data: new SlashCommandBuilder() .setName("refresh") .setDescription("Reloads all commands and config without restarting") .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), execute: async (interaction) => { await withCommandErrorHandling( interaction, async () => { const start = Date.now(); await AuroraClient.loadCommands(true); const duration = Date.now() - start; // Deploy commands await AuroraClient.deployCommands(); const embed = createSuccessEmbed( `Successfully reloaded ${AuroraClient.commands.size} commands in ${duration}ms.`, "System Refreshed" ); await interaction.editReply({ embeds: [embed] }); }, { ephemeral: true } ); } });