-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default select menu values #6442
Changes from all commits
8c51320
32567c6
c21255b
619a677
c6de9f5
bd05277
59a5570
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -215,7 +215,7 @@ There are 5 different [select menu components](#DOCS_INTERACTIONS_MESSAGE_COMPON | |||||
|
||||||
The string select menu (type `3`) is the *only* select type that allows (and *requires*) apps to define the `options` that appear in the dropdown list. The other 4 select menu components (users, roles, mentionables, and channels) are auto-populated with options corresponding to the resource type—similar to [command option types](#DOCS_INTERACTIONS_APPLICATION_COMMANDS/application-command-object-application-command-option-type). | ||||||
|
||||||
In addition to the `values` array in all [select menu interaction payloads](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-menu-interaction), auto-populated select menu components (users, roles, mentionables, and channels) also include an additional [`resolved` object](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-menu-resolved-object) that provides additional details about the user's selected resource. | ||||||
In addition to the `values` array in all [select menu interaction payloads](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-menu-interaction), auto-populated select menu components (user, role, mentionable, and channel) also include an additional [`resolved` object](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-menu-resolved-object) that provides additional details about the user's selected resource. | ||||||
|
||||||
The payloads for the select menu components are detailed in the [select menu structure](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-menu-structure). | ||||||
|
||||||
|
@@ -275,21 +275,24 @@ The payloads for the select menu components are detailed in the [select menu str | |||||
|
||||||
###### Select Menu Structure | ||||||
|
||||||
| Field | Type | Description | | ||||||
|--------------------|-------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||||||
| type | integer | [Type](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/component-object-component-types) of select menu component (text: `3`, user: `5`, role: `6`, mentionable: `7`, channels: `8`) | | ||||||
| custom_id | string | ID for the select menu; max 100 characters | | ||||||
| options?\* | array of [select options](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-option-structure) | Specified choices in a select menu (only required and available for string selects (type `3`); max 25 | | ||||||
| channel_types?\*\* | array of [channel types](#DOCS_RESOURCES_CHANNEL/channel-object-channel-types) | List of channel types to include in the channel select component (type `8`) | | ||||||
| placeholder? | string | Placeholder text if nothing is selected; max 150 characters | | ||||||
| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | | ||||||
| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | | ||||||
| disabled? | boolean | Whether select menu is disabled (defaults to `false`) | | ||||||
| Field | Type | Description | | ||||||
|-----------------------|---------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||||||
| type | integer | [Type](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/component-object-component-types) of select menu component (text: `3`, user: `5`, role: `6`, mentionable: `7`, channels: `8`) | | ||||||
| custom_id | string | ID for the select menu; max 100 characters | | ||||||
| options?\* | array of [select options](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-option-structure) | Specified choices in a select menu (only required and available for string selects (type `3`); max 25 | | ||||||
| channel_types?\*\* | array of [channel types](#DOCS_RESOURCES_CHANNEL/channel-object-channel-types) | List of channel types to include in the channel select component (type `8`) | | ||||||
| placeholder? | string | Placeholder text if nothing is selected; max 150 characters | | ||||||
| default_values?\*\*\* | array of [default value objects](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-default-value-structure) | List of default values for auto-populated select menu components; number of default values must be in the range defined by `min_values` and `max_values` | | ||||||
| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 | | ||||||
| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 | | ||||||
| disabled? | boolean | Whether select menu is disabled (defaults to `false`) | | ||||||
|
||||||
\* `options` is required for string select menus (component type `3`), and unavailable for all other select menu components. | ||||||
|
||||||
\*\* `channel_types` can only be used for channel select menu components. | ||||||
|
||||||
\*\*\* `default_values` is only available for auto-populated select menu components, which include user (`5`), role (`6`), mentionable (`7`), and channel (`8`) [components](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/component-object-component-types). | ||||||
|
||||||
###### Select Option Structure | ||||||
|
||||||
| Field | Type | Description | | ||||||
|
@@ -300,6 +303,13 @@ The payloads for the select menu components are detailed in the [select menu str | |||||
| emoji? | partial [emoji](#DOCS_RESOURCES_EMOJI/emoji-object) object | `id`, `name`, and `animated` | | ||||||
| default? | boolean | Will show this option as selected by default | | ||||||
|
||||||
###### Select Default Value Structure | ||||||
|
||||||
| Field | Type | Description | | ||||||
|-------|-----------|-------------------------------------------------------------------------------| | ||||||
| id | snowflake | ID of a user, role, or channel | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| type | string | Type of value that `id` represents. Either `"user"`, `"role"`, or `"channel"` | | ||||||
Comment on lines
+306
to
+311
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there plans for select menu default values to support the "default" property like select menu options? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what would that be for? presence in default_values makes it a default There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I thought default values were like choices but for non string type selects. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I can confirm from my testing that those validations are actually enforced There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Would be worth noting then imo |
||||||
|
||||||
###### Select Menu Interaction | ||||||
|
||||||
```json | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.