diff --git a/discord/app_commands/errors.py b/discord/app_commands/errors.py index 35a1eba8a..cad8052fa 100644 --- a/discord/app_commands/errors.py +++ b/discord/app_commands/errors.py @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. from __future__ import annotations -from typing import Any, TYPE_CHECKING, List, Optional, Type, Union +from typing import Any, TYPE_CHECKING, List, Optional, Union from ..enums import AppCommandOptionType, AppCommandType diff --git a/discord/app_commands/transformers.py b/discord/app_commands/transformers.py index 1fed3e9d6..e7ce6f961 100644 --- a/discord/app_commands/transformers.py +++ b/discord/app_commands/transformers.py @@ -202,6 +202,9 @@ class Transformer: def __call__(self) -> None: pass + def __or__(self, rhs: Any) -> Any: + return Union[self, rhs] # type: ignore + @property def type(self) -> AppCommandOptionType: """:class:`~discord.AppCommandOptionType`: The option type associated with this transformer. diff --git a/discord/ext/commands/hybrid.py b/discord/ext/commands/hybrid.py index 2dcabac56..6def19126 100644 --- a/discord/ext/commands/hybrid.py +++ b/discord/ext/commands/hybrid.py @@ -142,7 +142,7 @@ class ConverterTransformer(app_commands.Transformer): else: return await converter().convert(ctx, value) # type: ignore elif isinstance(converter, Converter): - return await converter.convert(ctx, value) # type: ignore + return await converter.convert(ctx, value) except CommandError: raise except Exception as exc: