#Can't use commands of other files
13 messages · Page 1 of 1 (latest)
- What's your exact discord.js
npm list discord.jsand nodenode -vversion? - Not a discord.js issue? Check out #1081585952654360687.
- 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!
✅Marked as resolved by OP
Node Version: 21.4.0
npm list discord.js: [email protected]
The commands don't appear when i write / with the bot + i have the ping command that normally you do in the index.js but i removed it (https://discord.js.org/docs/packages/discord.js/14.15.3) now i have that one /ping command even if i removed it from the code, instead of having the ping command of my ping.js file.
ping.js:
const { SlashCommandBuilder } = require('discord.js')
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Testing 2'),
async execute(interaction) {
await interaction.reply('Pong!');
},
};
The commands don't appear when i write / with the bot + i have the ping command that normally you do in the index.js but i removed it (https://discord.js.org/docs/packages/discord.js/14.15....
Did you deploy those commands with a deployment script after adding/changing them?
Do you mean doing nodemon ping.js stopping it and then doing nodemon index.js?
No. I meant registering your commands to discord API. Either by rest.put to the applicationCommands route or by doing <Client>.application.commands.set(…)
I didn't
You need to
https://discordjs.guide/creating-your-bot/command-deployment.html#guild-commands you mean with the rest.put in this part of documentation?
Yes