File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed
Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ def default(self, value: bool):
130130
131131 @property
132132 def value (self ) -> bool | None :
133- """Whether this checkbox was selected or not by the user."""
133+ """Whether this checkbox was selected or not by the user. This will be ``None`` if the checkbox has not been submitted via a modal yet. """
134134 return self ._value
135135
136136 def to_component_dict (self ) -> CheckboxComponentPayload :
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ def __init__(
9898 if not isinstance (required , bool ):
9999 raise TypeError (f"required must be bool not { required .__class__ .__name__ } " ) # type: ignore
100100 custom_id = os .urandom (16 ).hex () if custom_id is None else custom_id
101- self ._selected_values : list [str ] = []
101+ self ._selected_values : list [str ] | None = None
102102
103103 self ._underlying : CheckboxGroupComponent = self ._generate_underlying (
104104 custom_id = custom_id ,
@@ -188,8 +188,8 @@ def required(self, value: bool):
188188 self .underlying .required = bool (value )
189189
190190 @property
191- def values (self ) -> list [str ]:
192- """The values selected by the user."""
191+ def values (self ) -> list [str ] | None :
192+ """The values selected by the user. This will be ``None`` if the checkbox group has not been submitted in a modal yet. """
193193 return self ._selected_values
194194
195195 @property
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ def __init__(
8989 if not isinstance (required , bool ):
9090 raise TypeError (f"required must be bool not { required .__class__ .__name__ } " ) # type: ignore
9191 custom_id = os .urandom (16 ).hex () if custom_id is None else custom_id
92- self ._attachments : list [Attachment ] = []
92+ self ._attachments : list [Attachment ] | None = None
9393
9494 self ._underlying : FileUploadComponent = self ._generate_underlying (
9595 custom_id = custom_id ,
@@ -176,8 +176,8 @@ def required(self, value: bool):
176176 self .underlying .required = bool (value )
177177
178178 @property
179- def values (self ) -> list [Attachment ]:
180- """The files that were uploaded to the field."""
179+ def values (self ) -> list [Attachment ] | None :
180+ """The files that were uploaded to the field. This will be ``None`` if the file upload has not been submitted via a modal yet. """
181181 return self ._attachments
182182
183183 def to_component_dict (self ) -> FileUploadComponentPayload :
Original file line number Diff line number Diff line change @@ -661,14 +661,14 @@ def append_option(self, option: SelectOption) -> Self:
661661 return self
662662
663663 @property
664- def values (self ) -> list [ST ]:
664+ def values (self ) -> list [ST ] | None :
665665 """List[:class:`str`] | List[:class:`discord.Member` | :class:`discord.User`]] | List[:class:`discord.Role`]] |
666666 List[:class:`discord.Member` | :class:`discord.User` | :class:`discord.Role`]] | List[:class:`discord.abc.GuildChannel`] | None:
667667 A list of values that have been selected by the user. This will be ``None`` if the select has not been interacted with yet.
668668 """
669669 if self ._interaction is None or self ._interaction .data is None :
670670 # The select has not been interacted with yet
671- return []
671+ return None
672672 select_type = self .underlying .type
673673 if select_type is ComponentType .string_select :
674674 return self ._selected_values # type: ignore # ST is str
You can’t perform that action at this time.
0 commit comments