Skip to content

Commit 19037ce

Browse files
RateryLulalaby
authored andcommitted
Automatically set discord.Option.required to False if default is not None
1 parent e4f5a04 commit 19037ce

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

discord/commands/commands.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,12 +730,12 @@ def __init__(
730730
self.channel_types.append(channel_type)
731731
input_type = _type
732732
self.input_type = input_type
733-
self.required: bool = kwargs.pop("required", True)
733+
self.default = kwargs.pop("default", None)
734+
self.required: bool = kwargs.pop("required", True) if self.default is None else False
734735
self.choices: List[OptionChoice] = [
735736
o if isinstance(o, OptionChoice) else OptionChoice(o)
736737
for o in kwargs.pop("choices", list())
737738
]
738-
self.default = kwargs.pop("default", None)
739739

740740
if self.input_type == SlashCommandOptionType.integer:
741741
minmax_types = (int, type(None))

0 commit comments

Comments
 (0)