Giter Club home page Giter Club logo

Comments (6)

Jiralite avatar Jiralite commented on August 23, 2024 1

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.

almostSouji avatar almostSouji commented on August 23, 2024 1

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

from discord.js.

gustaveWPM avatar gustaveWPM commented on August 23, 2024

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.

gustaveWPM avatar gustaveWPM commented on August 23, 2024

This is expected behaviour.

Lmao, this is totally a bug, but fine.

from discord.js.

gustaveWPM avatar gustaveWPM commented on August 23, 2024

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.

almostSouji avatar almostSouji commented on August 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.