Comments (6)
This is expected behaviour.
Considering #10319 and this, it would be wiser for you to join the support server to receive help. Proficients in that server will escalate issues as needed.
from discord.js.
There are two scopes you can deploy commands to: commands local to the guild and global commands:
- Global commands are available to be used from any guild the bot is in. Accordingly, global commands will be available after re-invitation, after all they are globally available on just any guild.
- Local commands are specific to the guild they are deployed to and removing an application from a server (for example through guild settings > interactions or kicking the associated bot user) will also "uninstall" the app from the server. This includes the removal of all deployed guild-specific commands. On re-invitation you have to deploy these commands again, if you have a use case for guild-specific commands.
Since you are using the Routes.applicationGuildCommands
route, you are deploying local commands (2).
This is not a bug in discord.js but expected upstream behavior of the Discord API
You can read more about command scopes and contexts here: https://discord.com/developers/docs/interactions/application-commands#registering-a-command
from discord.js.
Also, this is why I'm asking how I can programatically reinitialize the bot to handle this edge case without using process.exit()
.
from discord.js.
This is expected behaviour.
Lmao, this is totally a bug, but fine.
from discord.js.
There are two scopes you can deploy commands to: commands local to the guild and global commands:
1. Global commands are available to be used from any guild the bot is in. Accordingly, global commands will be available after re-invitation, after all they are globally available on just any guild. 2. Local commands are specific to the guild they are deployed to and removing an application from a server (for example through guild settings > interactions or kicking the associated bot user) will also "uninstall" the app from the server. This includes the removal of all deployed guild-specific commands. On re-invitation you have to deploy these commands again, if you have a use case for guild-specific commands.
Since you are using the
Routes.applicationGuildCommands
route, you are deploying local commands (2). This is not a bug in discord.js but expected upstream behavior of the Discord API You can read more about command scopes and contexts here: https://discord.com/developers/docs/interactions/application-commands#registering-a-command
First of all: thank you a lot for this very insightful answer.
I understand that it is desirable to "Eject" slash commands as soon as they become pointless.
However, I think that if they're "Ejected" automatically when they're no longer needed, then they should be "Plugged" again as soon as they're needed again.
Simply because the current behaviour is very confusing for a user.
Because this is a very insidious side-effect that's hard to reason about.
It's pretty tricky to understand exactly where it's coming from in the first place, once you're confronted with this implicit "Eject" of slash commands.
It can also be panic-inducing, because, next, you wonder what else you might have that would also be "Ejected" like this.
And so you need to "guess" how you have to plug it in again (and what you have to plug in again).
Restarting the bot from scratch (and even more: by killing the process) because a user doesn't understand at all how to resume it properly at runtime is an aggressive solution. I understand that killing the process if it came to a state which is impossible to understand for me is a "straightforward" solution. But honestly, it doesn't make me happy at all to kill a whole process and restart it just because it came to a rabbit hole which is really hard to understand from a user perspective.
I think there could be a simple solution to make these side effects a little more comfortable to work with.
Simply logging them would be a plus in my opinion.
The best would be to make them as invisible as possible, as "For free" as possible.
Both in "deallocating" and "reallocating".
But that could potentially lead to undecidable situations that I may not be aware of.
from discord.js.
You seem to be conflating the two issues you opened in your message.
This one is about kicking the bot, which is expected upstream behavior. If you want to suggest a change to how Discord handles this, please open a feedback discussion in the upstream repository: https://github.com/discord/discord-api-docs/discussions
from discord.js.
Related Issues (20)
- Network errors still happening HOT 4
- TypeError: thread.members._add is not a function HOT 4
- Application Emojis HOT 2
- Client being destroyed before ready event when shard receives unexpected response 520 HOT 1
- Bot crash due to TypeError: Cannot read properties of undefined (reading 'get') handing THREAD_MEMBERS_UPDATE packet HOT 2
- Error [GuildMembersTimeout]: Members didn't arrive in time.
- Music is not playing in voice channel HOT 2
- WebSocketManager trying to access shard info while shard or shardId could be undefined HOT 6
- InteractionWebhook methods crash the app if an invalid token is provided HOT 4
- Unexpected end of JSON input when using `ZlibNative` & `zlib-stream` transport compression HOT 1
- Add USE_EXTERNAL_APPS Permission to permissionOverwrites HOT 1
- message.mentions.users.first() returns undefined HOT 2
- Group buttons produce no data in version `14.15.3` HOT 2
- Newly created emojis aren't added to cache HOT 4
- Error: Specified member is not UserResolvable. - TypeError [InvalidType]: Specified member is not a UserResolvable (ThreadMemberManager.add ) HOT 3
- Add type safety to interface AuditLogChange
- OAuth2 method for token revoke endpoint HOT 2
- Error happens when trying to edit a followup message: [Could not find the channel where this message came from in the cache!] HOT 8
- Bot prematurely ends output audio stream when I stop speaking HOT 1
- Type error with permissionOverwrites HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord.js.