Skip to content

Commit b081928

Browse files
committed
fix: handle users passing lists to StringSelectMenu
1 parent 5e26ef6 commit b081928

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

interactions/models/discord/components.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ class StringSelectMenu(BaseSelectMenu):
416416

417417
def __init__(
418418
self,
419-
*options: StringSelectOption | str | discord_typings.SelectMenuOptionData,
419+
*options: StringSelectOption | str | discord_typings.SelectMenuOptionData | list[StringSelectOption | str | discord_typings.SelectMenuOptionData],
420420
placeholder: str | None = None,
421421
min_values: int = 1,
422422
max_values: int = 1,
@@ -430,6 +430,10 @@ def __init__(
430430
custom_id=custom_id,
431431
disabled=disabled,
432432
)
433+
if isinstance(options, (list, tuple)) and len(options) == 1 and isinstance(options[0], (list, tuple)):
434+
# user passed in a list of options, expand it out
435+
options = options[0]
436+
433437
self.options: list[StringSelectOption] = [StringSelectOption.converter(option) for option in options]
434438
self.type: ComponentType = ComponentType.STRING_SELECT
435439

0 commit comments

Comments
 (0)