From 3bb4d3bd6d0fc43798228410eb109ca392374139 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 12 Apr 2022 00:18:29 -0400 Subject: [PATCH] Allow internal library enums to be used as an annotation --- discord/app_commands/transformers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/app_commands/transformers.py b/discord/app_commands/transformers.py index 6a7887c6d..5ab25ff66 100644 --- a/discord/app_commands/transformers.py +++ b/discord/app_commands/transformers.py @@ -47,7 +47,7 @@ from typing import ( from .errors import AppCommandError, TransformerError from .models import AppCommandChannel, AppCommandThread, Choice from ..channel import StageChannel, VoiceChannel, TextChannel, CategoryChannel -from ..enums import AppCommandOptionType, ChannelType +from ..enums import Enum as InternalEnum, AppCommandOptionType, ChannelType from ..utils import MISSING, maybe_coroutine from ..user import User from ..role import Role @@ -610,7 +610,7 @@ def get_supported_annotation( if inspect.isclass(annotation): if issubclass(annotation, Transformer): return (annotation, MISSING) - if issubclass(annotation, Enum): + if issubclass(annotation, (Enum, InternalEnum)): return (_make_enum_transformer(annotation), MISSING) if annotation is Choice: raise TypeError(f'Choice requires a type argument of int, str, or float')