Slash command unknown interaction without reload
I have been building a discord bot with slash commands, it is frustrating that everytime I restart my server, the discord page requires refresh/reload too to have the latest slash command
May I know what is the fix to it, have been trying to reset slash commands and clear cache too, but none is working

15 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!application commands are cached by your discord client, that's why it required a reload to cache the latest commands. You have nothing to do about it
Afaik, "Unknown Integration" error will try to fetch and cache the latest application commands. So you can just find and use the new command after encouraging the error without any issues
means that I have no other option than just reloading the page everytime so as the discord bot users?
yes. If so, what makes you register the commands everytime?
deployment, since I am running it with express
for each release, it will needa reg everytime
it's a rare error on production, even there's a new update. Only small users will encourage it, but they can just reuse the commands after that
this
for this, what's ur insights on writing the logic of the code?
abit lost haha
you should not register the commands every time it runs, only if you need to change the commands since you have a limited requests of commands register per day
makes 2 bots, one for development, only you can use it
and one for production, which has stable changes
so my thinking here would be
I will have a scripting that works on registering slash command that run only once unless function changes
and another scripting that is hosting 24/7 for dif interactionCreate, messagecCreate event?
just to make sure we are in the same page
I see, tat makes sense
but does the user face this error if production is renewing release?
yes, that should work too
or we could have a way to inform user the bot is in maintenance or smtg
this
I see, alright
Thanks for the insights! Appreciate that
but there's smtg that could work with this, I think it would be perfect, if anyone knows any method
you can rely in env variables, such as
NODE_ENV
. If it's production
, you can just makes the register automatically
Idk, it should only be in maintenance if you don't want users use it👍