Skip to content

Commit 96e6a30

Browse files
shaydewaelvaldotle
andcommitted
Default select menu values (discord#6442)
* add default select docs * small edits * classic * add resolved * Update docs/interactions/Message_Components.md Co-authored-by: Valle <81811276+Valle-infinitare@users.noreply.github.com> * add date * great i love this so much i love tables i love formatting --------- Co-authored-by: Valle <81811276+Valle-infinitare@users.noreply.github.com>
1 parent 3a0fa06 commit 96e6a30

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

docs/Change_Log.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## Default Value in Auto-populated Select Menus
4+
5+
#### Sep 22, 2023
6+
7+
A new `default_values` field was added for user (`5`), role (`6`), mentionable (`7`), and channel (`8`) [select menu components](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menus). `default_values` is a list of [default value objects](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-default-value-structure), which each include an `id` (the snowflake value for the resource), as well as a corresponding `type` (either `"user"`, `"role"`, or `"channel"`).
8+
39
## Team Member Roles
410

511
#### Aug 23, 2023

docs/interactions/Message_Components.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ There are 5 different [select menu components](#DOCS_INTERACTIONS_MESSAGE_COMPON
215215

216216
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).
217217

218-
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.
218+
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.
219219

220220
The payloads for the select menu components are detailed in the [select menu structure](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menu-object-select-menu-structure).
221221

@@ -275,21 +275,24 @@ The payloads for the select menu components are detailed in the [select menu str
275275

276276
###### Select Menu Structure
277277

278-
| Field | Type | Description |
279-
|--------------------|-------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
280-
| 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`) |
281-
| custom_id | string | ID for the select menu; max 100 characters |
282-
| 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 |
283-
| 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`) |
284-
| placeholder? | string | Placeholder text if nothing is selected; max 150 characters |
285-
| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 |
286-
| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 |
287-
| disabled? | boolean | Whether select menu is disabled (defaults to `false`) |
278+
| Field | Type | Description |
279+
|-----------------------|---------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
280+
| 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`) |
281+
| custom_id | string | ID for the select menu; max 100 characters |
282+
| 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 |
283+
| 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`) |
284+
| placeholder? | string | Placeholder text if nothing is selected; max 150 characters |
285+
| 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` |
286+
| min_values? | integer | Minimum number of items that must be chosen (defaults to 1); min 0, max 25 |
287+
| max_values? | integer | Maximum number of items that can be chosen (defaults to 1); max 25 |
288+
| disabled? | boolean | Whether select menu is disabled (defaults to `false`) |
288289

289290
\* `options` is required for string select menus (component type `3`), and unavailable for all other select menu components.
290291

291292
\*\* `channel_types` can only be used for channel select menu components.
292293

294+
\*\*\* `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).
295+
293296
###### Select Option Structure
294297

295298
| Field | Type | Description |
@@ -300,6 +303,13 @@ The payloads for the select menu components are detailed in the [select menu str
300303
| emoji? | partial [emoji](#DOCS_RESOURCES_EMOJI/emoji-object) object | `id`, `name`, and `animated` |
301304
| default? | boolean | Will show this option as selected by default |
302305

306+
###### Select Default Value Structure
307+
308+
| Field | Type | Description |
309+
|-------|-----------|-------------------------------------------------------------------------------|
310+
| id | snowflake | ID of a user, role, or channel |
311+
| type | string | Type of value that `id` represents. Either `"user"`, `"role"`, or `"channel"` |
312+
303313
###### Select Menu Interaction
304314

305315
```json

docs/resources/Channel.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ Represents a message sent in a channel within Discord.
299299
| stickers? | array of [sticker](#DOCS_RESOURCES_STICKER/sticker-object) objects | **Deprecated** the stickers sent with the message |
300300
| position? | integer | A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with `total_message_sent` on parent thread |
301301
| role_subscription_data? | [role subscription data](#DOCS_RESOURCES_CHANNEL/role-subscription-data-object) object | data of the role subscription purchase or renewal that prompted this ROLE_SUBSCRIPTION_PURCHASE message |
302+
| resolved? | [resolved](#DOCS_INTERACTIONS_RECEIVING_AND_RESPONDING/interaction-object-resolved-data-structure) data | data for users, members, channels, and roles in the message's [auto-populated select menus](#DOCS_INTERACTIONS_MESSAGE_COMPONENTS/select-menus) |
303+
302304

303305
\* The author object follows the structure of the user object, but is only a valid user in the case where the message is generated by a user or bot user. If the message is generated by a webhook, the author object corresponds to the webhook's id, username, and avatar. You can tell if a message is generated by a webhook by checking for the `webhook_id` on the message object.
304306

0 commit comments

Comments
 (0)