Making a /command
Hi, how would I go about making a command where any .js file in the folder /commands gets registered, and how do I register commands? I can’t get them to work. I want it to be guild only.
3 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!You need to iterate the folder and extract the name of the file from each file (.split('.')[0])
and then just follow the doc on how to register global commands
Use fs module to achieve that