Skip to content

Commit ef301fc

Browse files
committed
Find the chosen enum value using the raw value
1 parent 4cf035b commit ef301fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

discord/commands/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,8 @@ async def _invoke(self, ctx: ApplicationContext) -> None:
864864
arg = op._raw_type(int(arg))
865865
except ValueError:
866866
arg = op._raw_type(arg)
867-
else:
868-
arg = op._raw_type(arg)
867+
elif choice := find(lambda c: c.value == arg, op.choices):
868+
arg = getattr(op._raw_type, choice.name)
869869

870870
kwargs[op._parameter_name] = arg
871871

0 commit comments

Comments
 (0)