Browse Source

Remove command parameter from Group.on_error callback

Similar to the CommandTree.on_error removal, this one can be retrieved
using Interaction.command
pull/7888/head
Rapptz 3 years ago
parent
commit
4951231a7c
  1. 10
      discord/app_commands/commands.py

10
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.
"""

Loading…
Cancel
Save