how to sync the global command manually by myself
I have a main index.js file for my bot and I have a separate file for syncing the slash commands. Since I don't want to put the syncing code into main index.js file to let the bot sync every time while starting. But when I run the main index.js file and keeping it alive, I cannot execute any code which I could't run the syncing file to register my command. (if I ctrl+c, the bot will be terminated). Any idea of how this should be done or improved?
6 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!run your deploy file first, then your bot
you should only need to run it when you edit commands
but when I did deployment code first, it shows:
DiscordAPIError[20012]: You are not authorized to perform this action on this application
that error means your client id is incorrect, your client token is incorrect, and/or the id and token do not belong to the same application
the problem originates in the code for your deployment code
Yes that's the problem, thx a lot. But after I tried, I found this error while using slash command
ping
, it is a really simple and fast command, but why it takes more than 3 second and return the error in the console I host it locally on ubuntu (wsl). This should not be an internet problem. And I don't think I need to defer a ping command since it is fastit just indicates that your code takes over 3s to process, and is not related to djs