[commands] Fix error involving hybrid groups in Cog

This commit is contained in:
AAA3A 2023-02-11 01:33:27 +01:00 committed by GitHub
parent 9562a9683a
commit 742630f144
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -338,7 +338,7 @@ class Cog(metaclass=CogMeta):
app_command: Optional[Union[app_commands.Group, app_commands.Command[Self, ..., Any]]] = getattr( app_command: Optional[Union[app_commands.Group, app_commands.Command[Self, ..., Any]]] = getattr(
command, 'app_command', None command, 'app_command', None
) )
if app_command is not None: if app_command:
group_parent = self.__cog_app_commands_group__ group_parent = self.__cog_app_commands_group__
app_command = app_command._copy_with(parent=group_parent, binding=self) app_command = app_command._copy_with(parent=group_parent, binding=self)
# The type checker does not see the app_command attribute even though it exists # The type checker does not see the app_command attribute even though it exists