[commands] Properly set group parent for hybrid commands in cogs

This commit is contained in:
Rapptz 2022-05-01 15:01:01 -04:00
parent d39f9851a7
commit e873b8294a

View File

@ -292,7 +292,8 @@ class Cog(metaclass=CogMeta):
elif self.__cog_app_commands_group__:
if hasattr(command, '__commands_is_hybrid__') and command.parent is None:
# In both of these, the type checker does not see the app_command attribute even though it exists
command.app_command = command.app_command._copy_with(parent=self, binding=self) # type: ignore
parent = self.__cog_app_commands_group__
command.app_command = command.app_command._copy_with(parent=parent, binding=self) # type: ignore
children.append(command.app_command) # type: ignore
for command in cls.__cog_app_commands__: