'use strict'; const path = require('path'); const { SlashCommandBuilder } = require('discord.js'); const getCommands = require(path.join(__dirname, '../lib', 'getCommands.js')); const unregisterCommands = require(path.join(__dirname, '..', 'unregisterCommands.js')); const registerCommands = require(path.join(__dirname, '..', 'registerCommands.js')); const data = new SlashCommandBuilder() .setName('reload') .setDescription('Reload all commands to the latest version') .addBooleanOption(option => option.setName('full') .setDescription('Fully re-register the commands with discord?') ); const execute = async (interaction) => { await interaction.reply('Fetching commands...'); interaction.client.commands = getCommands(); if (interaction.options.getBoolean('full')) { await interaction.editReply('Unregistering commands...'); await unregisterCommands(); await interaction.editReply('Registering new commands...'); await registerCommands(); } await interaction.editReply('Successfully reloaded commands!'); }; module.exports = { data, execute };