From 4951231a7c93ac10c760eee7017dd46263587753 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 13 Apr 2022 22:45:06 -0400 Subject: [PATCH] Remove command parameter from Group.on_error callback Similar to the CommandTree.on_error removal, this one can be retrieved using Interaction.command --- discord/app_commands/commands.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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. """