Slash commands are not registered

I cleared commands with [], the commands cleared successfully. I re-register commands, commands that were previously registered appear, but my new file still does not want to register

deploy-commands.js:
import { REST, Routes } from 'discord.js'
import * as commandModules from '../commands/index.js'
import { config } from '../config.js'

const commands = []

for (const module of Object.values(commandModules)) {
  commands.push(module.data)
}

const rest = new REST({ version: '10' }).setToken(config.DISCORD_TOKEN)

rest
  .put(Routes.applicationCommands(config.CLIENT_ID), { body: commands })
  .then(() => {
    console.log('Successfully registered application commands')
    process.exit(0)
  })
  .catch(console.error)


hello.js:
import {SlashCommandBuilder} from 'discord.js'

export const data = new SlashCommandBuilder()
    .setName('hello')
    .setDescription('hello.')

export async function execute(interaction, client) {
    await interaction.reply(`This command was run by ${interaction.user.username}, who joined on ${interaction.member.joinedAt}.`)
}
Was this page helpful?