refactor(commands): rewrite app command storage to support multiple per-guild commands with the same name - #1107
Open
EQUENOS wants to merge 70 commits into
Open
refactor(commands): rewrite app command storage to support multiple per-guild commands with the same name#1107EQUENOS wants to merge 70 commits into
EQUENOS wants to merge 70 commits into
Conversation
3 tasks
8 tasks
Skelmis
reviewed
Sep 18, 2023
shiftinv
reviewed
Sep 22, 2023
shiftinv
left a comment
Member
There was a problem hiding this comment.
I have a bunch of mostly minor comments, but overall this looks really cool 👀
Member
|
Haven't tested much yet - not sure what exactly happened, but something somewhere ended up trying to register subcommands as top-level commands: https://gist.github.com/shiftinv/eddfcae9ca1f34790ced4a5288e3691f |
Also adds `alias_conflict` attribute for backwards compatibility
Member
Author
Fixed this in 1f10a8d |
…and-storage # Conflicts: # disnake/ext/commands/base_core.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Currently,
disnake.ext.commandsframework doesn't allow registering 2 guild commands with the same type and name in different guilds, even though discord API allows to do that (see issue #260). This PR solves this problem.Consequences
all_xxx_commandsattributes ofInteractionBotBaseare now deprecated in favor ofall_app_commandsbot.add_xxx_commandmethods are now deprecated in favor ofadd_app_commandbot.remove_xxx_commandmethods are now deprecated in favor ofremove_app_commandbot.get_xxx_commandnow works in O(1) only ifguild_idis specified, otherwise it's O(n) where n = len(all_app_commands)bot.get_xxx_commandcan be ambiguous ifguild_idis not specifiedguild_idofbot._ordered_unsynced_commandsis now deprecatedNote
The original idea of allowing to insert IDs of app commands to the corresponding invokable objects had to be abandoned. This is due to complications related to copying.
Checklist
pdm lintpdm pyright