Skip to content

Commit 8f903aa

Browse files
LumabotsLulalabypre-commit-ci[bot]
authored
fix: lala (#2896)
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>
1 parent 427a8d6 commit 8f903aa

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
@@ -806,6 +806,7 @@ def _parse_options(self, params, *, check_params: bool = True) -> list[Option]:
806806
if option == inspect.Parameter.empty:
807807
option = str
808808

809+
option = Option._strip_none_type(option)
809810
if self._is_typing_literal(option):
810811
literal_values = get_args(option)
811812
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
@@ -386,9 +386,9 @@ def _strip_none_type(input_type):
386386
raise TypeError("Option type cannot be only NoneType")
387387
if len(filtered) == 1:
388388
return filtered[0]
389-
if all(getattr(t, "__origin__", None) is Literal for t in filtered):
390-
return Union[filtered]
391-
return Union[filtered]
389+
390+
return filtered
391+
392392
return input_type
393393

394394
def to_dict(self) -> dict:

0 commit comments

Comments
 (0)