Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!