File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -184,10 +184,9 @@ def selected_options(self) -> Optional[List[Dict]]:
184
184
-------
185
185
Optional[List[Dict]]
186
186
A dictionary containing the options and values that were selected by the user when the command was processed, if applicable.
187
+ Returns ``None`` if the command has not yet been invoked, or if there are no options defined for that command.
187
188
"""
188
- if "options" in self .interaction .data :
189
- return self .interaction .data ["options" ]
190
- return None
189
+ return self .interaction .data .get ("options" , None )
191
190
192
191
@property
193
192
def unselected_options (self ) -> Optional [List [Option ]]:
@@ -197,13 +196,17 @@ def unselected_options(self) -> Optional[List[Option]]:
197
196
-------
198
197
Optional[List[:class:`.Option`]]
199
198
A list of Option objects (if any) that were not selected by the user when the command was processed.
199
+ Returns ``None`` if there are no options defined for that command.
200
200
"""
201
201
if self .command .options is not None : # type: ignore
202
- return [
203
- option
204
- for option in self .command .options # type: ignore
205
- if option .to_dict ()["name" ] not in [opt ["name" ] for opt in self .selected_options ]
206
- ]
202
+ if self .selected_options :
203
+ return [
204
+ option
205
+ for option in self .command .options # type: ignore
206
+ if option .to_dict ()["name" ] not in [opt ["name" ] for opt in self .selected_options ]
207
+ ]
208
+ else :
209
+ return self .command .options # type: ignore
207
210
return None
208
211
209
212
@property
You can’t perform that action at this time.
0 commit comments