Skip to content

Commit 78ae3d4

Browse files
LumabotsLulalabypre-commit-ci[bot]
authored andcommitted
Signed-off-by: Lumouille <[email protected]> Co-authored-by: Lala Sabathil <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> (cherry picked from commit 8f903aa)
1 parent a69e354 commit 78ae3d4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

discord/commands/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ def _parse_options(self, params, *, check_params: bool = True) -> list[Option]:
780780
if option == inspect.Parameter.empty:
781781
option = str
782782

783+
option = Option._strip_none_type(option)
783784
if self._is_typing_literal(option):
784785
literal_values = get_args(option)
785786
if not all(isinstance(v, (str, int, float)) for v in literal_values):

discord/commands/options.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,9 @@ def _strip_none_type(input_type):
350350
raise TypeError("Option type cannot be only NoneType")
351351
if len(filtered) == 1:
352352
return filtered[0]
353-
if all(getattr(t, "__origin__", None) is Literal for t in filtered):
354-
return Union[filtered]
355-
return Union[filtered]
353+
354+
return filtered
355+
356356
return input_type
357357

358358
def to_dict(self) -> dict:

0 commit comments

Comments
 (0)