Properly set root parent before copying a command's binding

This commit is contained in:
Rapptz
2022-03-15 03:15:07 -04:00
parent ca4db68686
commit 5bc085ebab
2 changed files with 4 additions and 4 deletions

View File

@ -249,12 +249,12 @@ class Cog(metaclass=CogMeta):
# Register the application commands
children: List[Union[app_commands.Group, app_commands.Command[Self, ..., Any]]] = []
for command in cls.__cog_app_commands__:
copy = command._copy_with_binding(self)
if cls.__cog_is_app_commands_group__:
# Type checker doesn't understand this type of narrowing.
# Not even with TypeGuard somehow.
copy.parent = self # type: ignore
command.parent = self # type: ignore
copy = command._copy_with_binding(self)
children.append(copy)
if command._attr: