Tutorial Slash Command
https://discordjs.guide/creating-your-bot/slash-commands.html#before-you-continue
I got as far as the bit before it requests to create:
- commands/utility/user.js
- commands/utility/server.js
At this point it is supposed to respond with pong when I send ping. In in a text channel I think.
Can someone confirm this and help meunderstand why mine isn't working?
discord.js Guide
Imagine a guide... that explores the many possibilities for your discord.js bot.
29 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!1. Did you ever deploy your commands to discord (so they show up when you press / in your server)?
2. Do you have a
client.on("interactionCreate")
handler anywhere (either in an events/interactionCreate.js
or index.js
)?
Creating a command file is only part of the process. You have to keep going in the guide for "Command handling", "Registering slash commands", and "Event handling" before you can use the commandsAh, okay, so it's not meant to respond yet
No, it's not
If they don't appear like this, then Discord doesn't know your commands exist yet (which can be done in the "Registering slash commands" section)

Where is the file you speak of in the folders:
GitHub
guide/code-samples/creating-your-bot/slash-commands at main · disc...
The official guide for discord.js, created and maintained by core members of its community. - discordjs/guide
It still doesn't work.
None of these guides make any damn sense
It's so depressing and uninspiring
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
I wanted to build a bot. Nothing makes sense. Nothing runs.
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
The samecode as you have on the github
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
and then at some points it just jumps you just expand the code and nothinbgn makes sense
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
show your
index.js
to start with
thats the core of your entire codeUnknown User•3w ago
Message Not Public
Sign In & Join Server To View
There's no point. It's too late. Wasted hours on different versions that just don't work. This project is depressing
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
You can also just sleep on it and ask again tomorrow. Getting frustrated with code not working can sometimes just need a "fresh pair of eyes" and just try again later to figure out
It's quite simple really. Just attempt to complete the discord.js guide. None of it works.
Good Night
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View
the guide definitely works. thats how i learned how to use the library. but if you put code into a file OTHER than your
index.js
, then you need to do something in index.js
to load that file. your code only does what you tell it to. it doesn't magically know that commands/utility/ping.js
is a command file unless you tell it somewhere to load it as a command file, etc..etc..etc
"none of it works" is user error, not an error of the guideUnknown User•3w ago
Message Not Public
Sign In & Join Server To View
I'm sorry. The DJS guide is one of the best made guides for an npm package I've ever seen (maybe other than a frontend framework like Auth.js competes)
Unknown User•3w ago
Message Not Public
Sign In & Join Server To View