slash commands not showing up

i have a file register-commands.jswhere i register slash commands but it is not appearing in discord client
require('dotenv').config();
const { REST,Routes} = require("discord.js")


const commands = [
{
name:'ping',
description:'pong',
}
]

const rest = new REST({version:'10'}).setToken(process.env.TOKEN);

(async () => {
try {
console.log('registering slash commands')
await rest.put(
Routes.applicationGuildCommands(
process.env.CLIENT_ID,
process.env.GUILD_ID)
),
{
body: commands
};
console.log('registered slash commands');
} catch (error) {
console.log(`there was an error error: ${error}`);

}

})();
require('dotenv').config();
const { REST,Routes} = require("discord.js")


const commands = [
{
name:'ping',
description:'pong',
}
]

const rest = new REST({version:'10'}).setToken(process.env.TOKEN);

(async () => {
try {
console.log('registering slash commands')
await rest.put(
Routes.applicationGuildCommands(
process.env.CLIENT_ID,
process.env.GUILD_ID)
),
{
body: commands
};
console.log('registered slash commands');
} catch (error) {
console.log(`there was an error error: ${error}`);

}

})();
output : registering slash commands registered slash commands
19 Replies
d.js toolkit
d.js toolkit•3w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Mark
Mark•3w ago
did you reload your client? did you check the guild -> integrations tab?
kwiee
kwieeOP•3w ago
where can i find the guild -> integration tab
Retro
Retro•3w ago
No description
Mark
Mark•3w ago
in your guild settings
kwiee
kwieeOP•3w ago
oh alright yes my bot is showing up and it has every permission checked
Mark
Mark•3w ago
does the command show up
kwiee
kwieeOP•3w ago
nope
felix2336
felix2336•3w ago
I guess the issue here is that the object which contains the body is not inside the put method
kwiee
kwieeOP•3w ago
the bot is replying to my messages when i run index.js the main file but the bot doesnt turn on when i run
register-commands
register-commands
Retro
Retro•3w ago
jesus how did we miss that
treble/luna
treble/luna•3w ago
that is normal the deploy script just registers your commands
kwiee
kwieeOP•3w ago
ahh my bad
treble/luna
treble/luna•3w ago
It doesnt need to happen every time your bot starts, thats why its separate
kwiee
kwieeOP•3w ago
so if i just have to run register commands once?
treble/luna
treble/luna•3w ago
Whenever you edit your command data yes
kwiee
kwieeOP•3w ago
it worked thanks!! is there any new method to do this cause i followed an old tutorial
d.js docs
d.js docs•3w ago
:guide: Creating Your Bot: Registering slash commands read more
kwiee
kwieeOP•3w ago
thanks 🫡

Did you find this page helpful?