From 9da131ed268701dd5e6017723ca8d8b379c353d3 Mon Sep 17 00:00:00 2001 From: PythonCoderAS <13932583+PythonCoderAS@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:58:24 -0400 Subject: [PATCH] Fix variance typing issue with CommandTree.error decorator --- discord/app_commands/tree.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/app_commands/tree.py b/discord/app_commands/tree.py index bc0d68ec7938..90b9a21ab958 100644 --- a/discord/app_commands/tree.py +++ b/discord/app_commands/tree.py @@ -73,7 +73,7 @@ from .commands import ContextMenuCallback, CommandCallback, P, T ErrorFunc = Callable[ - [Interaction, AppCommandError], + [Interaction[ClientT], AppCommandError], Coroutine[Any, Any, Any], ] @@ -833,7 +833,7 @@ async def on_error(self, interaction: Interaction[ClientT], error: AppCommandErr else: _log.error('Ignoring exception in command tree', exc_info=error) - def error(self, coro: ErrorFunc) -> ErrorFunc: + def error(self, coro: ErrorFunc[ClientT]) -> ErrorFunc[ClientT]: """A decorator that registers a coroutine as a local error handler. This must match the signature of the :meth:`on_error` callback.