Skip to content
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

Merged
merged 7 commits into from
Sep 22, 2023
Merged

Conversation

shaydewael
Copy link
Contributor

New default_values array for auto-populated select menus

@shaydewael shaydewael added the not released This issue or PR is referencing a change that is not yet widely released and/or subject to change. label Sep 20, 2023
Comment on lines +306 to +311
###### Select Default Value Structure

| Field | Type | Description |
|-------|-----------|-------------------------------------------------------------------------------|
| id | snowflake | ID of a user, role, or channel |
| type | string | Type of value that `id` represents. Either `"user"`, `"role"`, or `"channel"` |
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Contributor

@valdotle valdotle Sep 20, 2023

Choose a reason for hiding this comment

The 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.
In that case, is validation for the min/max_values and proper types (going to be) enforced on default values as well?

Copy link
Contributor

@Misha-133 Misha-133 Sep 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is validation for the min/max_values and proper types (going to be) enforced on default values as well

I can confirm from my testing that those validations are actually enforced

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm from my testing that those validations are actually enforced

Would be worth noting then imo

@@ -1,5 +1,9 @@
# Change Log

## Default Value in Auto-populated Select Menus

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"`).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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"`).
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 its corresponding `type` (either `"user"`, `"role"`, or `"channel"`).

@Misha-133
Copy link
Contributor

Should this also mention the resolved field in message objects containing components?
It seems to hold the resolved data for default values set in select menus
image

@Lulalaby
Copy link
Contributor

Is it intended that the type channel is invalid for mentionable (7) selects?

image

@advaith1
Copy link
Contributor

yes, mentionable has always been users and roles

@Lulalaby
Copy link
Contributor

oh right. nvm then!


| Field | Type | Description |
|-------|-----------|-------------------------------------------------------------------------------|
| id | snowflake | ID of a user, role, or channel |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| id | snowflake | ID of a user, role, or channel |
| id | snowflake | ID of a user, role, or channel; depending on the select menu type |

docs/interactions/Message_Components.md Outdated Show resolved Hide resolved
Comment on lines +306 to +311
###### Select Default Value Structure

| Field | Type | Description |
|-------|-----------|-------------------------------------------------------------------------------|
| id | snowflake | ID of a user, role, or channel |
| type | string | Type of value that `id` represents. Either `"user"`, `"role"`, or `"channel"` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm from my testing that those validations are actually enforced

Would be worth noting then imo

@shaydewael shaydewael marked this pull request as ready for review September 22, 2023 16:57
Co-authored-by: Valle <81811276+Valle-infinitare@users.noreply.github.com>
@Lulalaby
Copy link
Contributor

Not the table again 😂

@shaydewael shaydewael removed the not released This issue or PR is referencing a change that is not yet widely released and/or subject to change. label Sep 22, 2023
@shaydewael shaydewael merged commit 515931a into discord:main Sep 22, 2023
3 checks passed
@shaydewael shaydewael deleted the default-selects branch September 22, 2023 19:48
mccoderpy added a commit to mccoderpy/discord.py-message-components that referenced this pull request Sep 23, 2023
lukellmann added a commit to kordlib/kord that referenced this pull request Sep 30, 2023
The DSL looks like this:
val message = channel.createMessage {
    actionRow {
        mentionableSelect("customId") {
            allowedValues = 0..5
            defaultUsers += userId
            defaultRoles += roleId
        }
    }
}

See discord/discord-api-docs#6442
Nihlus added a commit to Remora/Remora.Discord that referenced this pull request Oct 29, 2023
Nihlus added a commit to Remora/Remora.Discord that referenced this pull request Oct 29, 2023
lukellmann added a commit to kordlib/kord that referenced this pull request Nov 18, 2023
The DSL looks like this:
val message = channel.createMessage {
    actionRow {
        mentionableSelect("customId") {
            allowedValues = 0..5
            defaultUsers += userId
            defaultRoles += roleId
        }
    }
}

See discord/discord-api-docs#6442
@bsian03 bsian03 mentioned this pull request Jan 17, 2024
21 tasks
shaydewael added a commit to Jupith/discord-api-docs that referenced this pull request May 14, 2024
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants