diff --git a/discord/commands/core.py b/discord/commands/core.py index 6400ed30f7..90e7c5aa60 100644 --- a/discord/commands/core.py +++ b/discord/commands/core.py @@ -806,6 +806,7 @@ def _parse_options(self, params, *, check_params: bool = True) -> list[Option]: if option == inspect.Parameter.empty: option = str + option = Option._strip_none_type(option) if self._is_typing_literal(option): literal_values = get_args(option) if not all(isinstance(v, (str, int, float)) for v in literal_values): diff --git a/discord/commands/options.py b/discord/commands/options.py index eb8ec6ecfc..d2d228126a 100644 --- a/discord/commands/options.py +++ b/discord/commands/options.py @@ -386,9 +386,9 @@ def _strip_none_type(input_type): raise TypeError("Option type cannot be only NoneType") if len(filtered) == 1: return filtered[0] - if all(getattr(t, "__origin__", None) is Literal for t in filtered): - return Union[filtered] - return Union[filtered] + + return filtered + return input_type def to_dict(self) -> dict: