Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

146
Visualizações
Why slash command discordjs not register

I'm tired of this because I can't fix it. It doesn't register. I will follow this gudie https://discordjs.guide/interactions/registering-slash-commands.html#global-commands

const command = require(path.join(__dirname, '..', 'commands', 'slash') + '/' + files)
       console.log(command.name + " Is Register")
       let cmd = command.register();
       commandsList.push(cmd)
       console.log(commandsList)
       const rest = new REST({ version: '9' }).setToken(token);
       (async () => {
         try {
           console.log('Started refreshing application (/) commands.');
       
           await rest.put(
             Routes.applicationCommands("894136598982180905"),
             { body: commandsList },
           );
       
           console.log('Successfully reloaded application (/) commands.');
         } catch (error) {
           console.error(error);
         }
       })();

I will log SlashCommandBuilder show this commandsList

[
 {
   name: 'ping',
   description: 'Ping Commands',
   options: [],
   default_permission: undefined
 }
]

Slash Command Builder File

const { SlashCommandBuilder } = require('@discordjs/builders');


module.exports = {
 name: "Ping",
 register() {
   const data = new SlashCommandBuilder().
   setName("ping")
   .setDescription("Ping Commands")
   .toJSON();
   return data;
 },
};

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

As MrMythical correctly mentioned, most commonly it happens when you didn't give application. commands scope for the bot's invite link.
If it's your case - kick the bot from your server, and create a new link with bot and application. commands scopes, give proper permission set and re-invite it again.
But I've just had the same issue even though it was properly invited (and has worked before). For me, the solution was to regenerate the Token at Discord Developer Portal and restart the bot with the new token. After that - it again works like a charm.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda