Skip to content

Commit 9a595be

Browse files
committed
Fixed #95
1 parent 6830e51 commit 9a595be

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

discord_slash/utils/manage_commands.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ def generate_options(function: Callable, description: str = "No description.") -
194194
# if from __future__ import annotations, then annotations are strings and should be converted back to types
195195
param = param.replace(annotation=eval(param.annotation, function.__globals__))
196196

197-
if getattr(param.annotation, "__origin__", None) is typing.Union:
197+
if param.default is not inspect._empty:
198+
required = False
199+
elif getattr(param.annotation, "__origin__", None) is typing.Union:
198200
# Make a command argument optional with typing.Optional[type] or typing.Union[type, None]
199201
args = getattr(param.annotation, "__args__", None)
200202
if args:

0 commit comments

Comments
 (0)