Discord.JS First Slash command guide not working
when I use the /ping command I get "The Application did not respond in time":
I have deployed the deploy-commands.ts code and it ran successfully.
Here is my code for my ping.ts command:
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction : any) {
await interaction.reply('Pong!');
},
};


22 Replies
- 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!
- ✅
Marked as resolved by OPDon't have any error messages while running any file
the code in the picture above is for the deploy-commands.ts
and here is main.ts

How are you running the code?
so to run the deploy script
Are you transpiling it first and running the outputted JS or using something like ts-node?
i just do npm run dev in the terminal

i got the package.json
i just change the name of the file to ruin the deploy script
since it says u just needa run it once
then i go back and keep the main script running
Ok, I would make sure your command files are actually being loaded
If you aren't getting any errors, try to place
console.log
checkpoints throughout your code to find out where execution stops.
- Once you do, log relevant values and if-conditions
- More sophisticated debugging methods are breakpoints and runtime inspections: learn moreya already done
let me show u

sec

thats for this for loop right here
meaning i can get the command

but if i put it in this part it wont show
the client.on part
Events.InteractionCreate
The enum member names are case-sensitive
oh my god
ok thanks its fixed
idk how u caught that but good work G