mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-03 08:35:53 +00:00
Fix cog_app_command_error for groups
This commit is contained in:
@ -328,6 +328,13 @@ class Cog(metaclass=CogMeta):
|
||||
if self.__cog_app_commands_group__:
|
||||
children.append(app_command)
|
||||
|
||||
if Cog._get_overridden_method(self.cog_app_command_error) is not None:
|
||||
error_handler = self.cog_app_command_error
|
||||
else:
|
||||
error_handler = None
|
||||
|
||||
self.__app_commands_error_handler__ = error_handler
|
||||
|
||||
for command in cls.__cog_app_commands__:
|
||||
copy = command._copy_with(parent=self.__cog_app_commands_group__, binding=self)
|
||||
|
||||
@ -335,6 +342,9 @@ class Cog(metaclass=CogMeta):
|
||||
if copy._attr:
|
||||
setattr(self, copy._attr, copy)
|
||||
|
||||
if isinstance(copy, app_commands.Group):
|
||||
copy.__app_commands_error_handler__ = error_handler
|
||||
|
||||
children.append(copy)
|
||||
|
||||
self.__cog_app_commands__ = children
|
||||
@ -346,11 +356,6 @@ class Cog(metaclass=CogMeta):
|
||||
|
||||
self.__cog_app_commands_group__._children = mapping # type: ignore # Variance issue
|
||||
|
||||
if Cog._get_overridden_method(self.cog_app_command_error) is not None:
|
||||
self.__app_commands_error_handler__ = self.cog_app_command_error
|
||||
else:
|
||||
self.__app_commands_error_handler__ = None
|
||||
|
||||
return self
|
||||
|
||||
def get_commands(self) -> List[Command[Self, ..., Any]]:
|
||||
|
Reference in New Issue
Block a user