mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 12:18:59 +00:00
Remove command parameter from Group.on_error callback
Similar to the CommandTree.on_error removal, this one can be retrieved using Interaction.command
This commit is contained in:
parent
ce15df4275
commit
4951231a7c
@ -556,10 +556,10 @@ class Command(Generic[GroupT, P, T]):
|
|||||||
|
|
||||||
parent = self.parent
|
parent = self.parent
|
||||||
if parent is not None:
|
if parent is not None:
|
||||||
await parent.on_error(interaction, self, error)
|
await parent.on_error(interaction, error)
|
||||||
|
|
||||||
if parent.parent is not None:
|
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:
|
def _has_any_error_handlers(self) -> bool:
|
||||||
if self.on_error is not None:
|
if self.on_error is not None:
|
||||||
@ -1159,19 +1159,19 @@ class Group:
|
|||||||
if isinstance(command, Group):
|
if isinstance(command, Group):
|
||||||
yield from command.walk_commands()
|
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|
|
"""|coro|
|
||||||
|
|
||||||
A callback that is called when a child's command raises an :exc:`AppCommandError`.
|
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.
|
The default implementation does nothing.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
-----------
|
-----------
|
||||||
interaction: :class:`~discord.Interaction`
|
interaction: :class:`~discord.Interaction`
|
||||||
The interaction that is being handled.
|
The interaction that is being handled.
|
||||||
command: :class:`~discord.app_commands.Command`
|
|
||||||
The command that failed.
|
|
||||||
error: :exc:`AppCommandError`
|
error: :exc:`AppCommandError`
|
||||||
The exception that was raised.
|
The exception that was raised.
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user