© 2026 Hedgehog Software, LLC
24[APPLICATION_COMMANDS_DUPLICATE_NAME]: Application command names must be unique
const { REST } = require('@discordjs/rest'); const { Routes } = require('discord-api-types/v9'); const fs = require('fs'); const clientId = '966666309909770260'; const guildId = '966987181069598731'; module.exports = (client) => { client.handleCommands = async (slashCommandFolders, path) => { client.slashCommandArray = []; for (folder of slashCommandFolders) { const slashCommandFiles = fs.readdirSync(`${path}/${folder}`).filter(file => file.endsWith('.js')); for (const file of slashCommandFiles) { const command = require(`../slashcommands/${folder}/${file}`); client.slashcommands.set(command.data.name, command) client.slashCommandArray.push(command.data.toJSON()); } const rest = new REST({ version: '9' }).setToken(process.env.DISCORD_TOKEN); (async () => { try { console.log('Started refreshing application (/) commands.'); await rest.put( Routes.applicationGuildCommands(clientId, guildId), { body: client.slashCommandArray }, ); console.log('Started refreshing application (/) commands.'); } catch (error) { console.error(error); } })(); } } }