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
d.js toolkit
d.js toolkit8mo 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!
d.js docs
d.js docs8mo ago
:guide: Creating Your Bot: Registering slash commands read more :guide: Creating Your Bot: Creating slash commands read more :guide: Creating Your Bot: Command handling read more
royc
royc8mo ago
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
Want results from more Discord servers?
Add your server