disnake
disnake copied to clipboard
feat: add `parent` attributes to slash subcommands and groups
Summary
This PR implements parent references for slash subcommands.
- add
SubCommandGroup.parent - add
SubCommand.parent - add
SubCommand.root_command
Checklist
- [x] If code changes were made, then they have been tested
- [x] I have updated the documentation to reflect the changes
- [x] I have formatted the code properly by running
task lint - [x] I have type-checked the code by running
task pyright
- [ ] This PR fixes an issue
- [x] This PR adds something new (e.g. new method or parameters)
- [ ] (maybe) This PR is a breaking change (e.g. methods or parameters removed/renamed)
- [ ] This PR is not a code change (e.g. documentation, README, ...)
could
qualified_namebe a property that uses the parent to determine the name?
Yeah but there're no scenarios where subcommands move to another parent. Renames are not supported either so having attributes instead of properties should be fine for now.
could
qualified_namebe a property that uses the parent to determine the name?Yeah but there're no scenarios where subcommands move to another parent. Renames are not supported either so having attributes instead of properties should be fine for now.
fair
Perhaps a
parentsfield
I don't think it's needed because we have root_command. The only use case of parents is to get all parents of a subcommand (with assistance of isinstance), which can be easily done with parent, root_command and isinstance
Also another issue with the slash command copy - the
parentstill points to the old instance
Ah, right, I forgot to test copies... I will fix that.
Perhaps a
parentsfieldI don't think it's needed because we have
root_command. The only use case ofparentsis to get all parents of a subcommand (with assistance ofisinstance), which can be easily done withparent,root_commandandisinstance
We have the same for disnake.ext.commands.Command.
InvokableSlashCommand should have a parent attribute too, but this can be None.
InvokableSlashCommandshould have a parent attribute too, but this can be None.
It's there, I added it after the first review