sapphiredev/framework

request: [CoreReady listener] automatically delete application commands not found in the Command store

favna opened this issue · 0 comments

favna commented

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

We often get requests if Sapphire can automatically delete application commands when initialising the bot. One way to achieve that is by diffing the list of container.client.application.commands with what is actually in the Sapphire Commands store on the ready event.

Desired solution

We should add an additional optional listener that diffs the two lists and deletes any commands that are in container.client.application.commands , but are not in container.stores.get('commands'). This optional listener should be toggable on client level with the option automaticallyDeleteUnknownCommands. To keep the comparison simple we should only compare names in both the lists.

This new option and its implications, such as name comparison, should be documented in the guide. While that has to be a separate PR to https://github.com/sapphiredev/website, this issue is not resolved until both PRs are finished.

Alternatives considered

N.A.

Additional context

No response