Skip to content

Commit b1024cd

Browse files
committed
better pythonicness
1 parent a8fcb34 commit b1024cd

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

discord/commands/context.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,22 +174,20 @@ def response(self) -> InteractionResponse:
174174

175175
@property
176176
def selected_options(self) -> Optional[List[Dict]]:
177-
"""Returns a dictionary containing the options and values that were selected by the user, if applicable."""
177+
"""Returns a dictionary containing the options and values that were selected by the user when the command was processed, if applicable."""
178178
if "options" in self.interaction.data:
179179
return self.interaction.data["options"]
180180
return None
181181

182182
@property
183-
def unselected_options(self) -> Optional[List[Dict]]:
184-
"""Returns a dictionary containing the options that were not selected by the user, if applicable."""
183+
def unselected_options(self) -> Optional[List[Option]]:
184+
"""Returns a list of Option objects (if any) that were not selected by the user when the command was processed."""
185185
if self.command.options is not None: # type: ignore
186-
selected = [opt["name"] for opt in self.selected_options]
187186
return [
188187
option
189188
for option in self.command.options # type: ignore
190-
if option.to_dict()["name"] not in selected
189+
if option.to_dict()["name"] not in [opt["name"] for opt in self.selected_options]
191190
]
192-
193191
return None
194192

195193
@property

0 commit comments

Comments
 (0)