diff --git a/discord/app_commands/commands.py b/discord/app_commands/commands.py index 4bc95c5a6..c0b6a3dd0 100644 --- a/discord/app_commands/commands.py +++ b/discord/app_commands/commands.py @@ -556,10 +556,10 @@ class Command(Generic[GroupT, P, T]): parent = self.parent if parent is not None: - await parent.on_error(interaction, self, error) + await parent.on_error(interaction, error) if parent.parent is not None: - await parent.parent.on_error(interaction, self, error) + await parent.parent.on_error(interaction, error) def _has_any_error_handlers(self) -> bool: if self.on_error is not None: @@ -1159,19 +1159,19 @@ class Group: if isinstance(command, Group): yield from command.walk_commands() - async def on_error(self, interaction: Interaction, command: Command[Any, ..., Any], error: AppCommandError) -> None: + async def on_error(self, interaction: Interaction, error: AppCommandError) -> None: """|coro| A callback that is called when a child's command raises an :exc:`AppCommandError`. + To get the command that failed, :attr:`discord.Interaction.command` should be used. + The default implementation does nothing. Parameters ----------- interaction: :class:`~discord.Interaction` The interaction that is being handled. - command: :class:`~discord.app_commands.Command` - The command that failed. error: :exc:`AppCommandError` The exception that was raised. """