Skip to content

Commit 29da1e6

Browse files
Merge branch 'main' into test/builders-validation
2 parents 9fad97d + ace834b commit 29da1e6

File tree

98 files changed

+4063
-218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+4063
-218
lines changed
4.49 KB
Loading
-24.6 KB
Binary file not shown.

apps/guide/content/docs/legacy/interactions/modals.mdx

Lines changed: 297 additions & 70 deletions
Large diffs are not rendered by default.

apps/guide/content/docs/legacy/interactive-components/select-menus.mdx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@
22
title: Select Menus
33
---
44

5-
Select menus are one of the `MessageComponent` classes, which can be sent via messages or interaction responses.
5+
Select menus are interactive components which can be sent via messages, interaction responses, or in modals.
66

77
<Callout>
88
This page is a follow-up to the [slash commands](../slash-commands/advanced-creation) section and [action
99
rows](../interactive-components/action-rows) page. Please carefully read those pages first so that you can understand
1010
the methods used here.
1111
</Callout>
12+
<Callout>
13+
This page is for using select menus in messages. For using [select menus in
14+
modals](../interactions/modals#select-menu) visit the modal page
15+
</Callout>
1216

1317
## Building string select menus
1418

@@ -22,13 +26,17 @@ const { StringSelectMenuBuilder, StringSelectMenuOptionBuilder, SlashCommandBuil
2226
module.exports = {
2327
// data: new SlashCommandBuilder()...
2428
async execute(interaction) {
25-
const select = new StringSelectMenuBuilder()
29+
const favoriteStarterSelect = new StringSelectMenuBuilder()
2630
.setCustomId('starter')
2731
.setPlaceholder('Make a selection!')
2832
.addOptions(
33+
// String select menu options
2934
new StringSelectMenuOptionBuilder()
35+
// Label displayed to user
3036
.setLabel('Bulbasaur')
37+
// Description of option
3138
.setDescription('The dual-type Grass/Poison Seed Pokémon.')
39+
// Value returned in select menu interaction
3240
.setValue('bulbasaur'),
3341
new StringSelectMenuOptionBuilder()
3442
.setLabel('Charmander')
@@ -59,17 +67,21 @@ const {
5967
StringSelectMenuOptionBuilder,
6068
SlashCommandBuilder,
6169
} = require('discord.js');
62-
// [!code focus:30]
70+
// [!code focus:33]
6371
module.exports = {
6472
// data: new SlashCommandBuilder()...
6573
async execute(interaction) {
66-
const select = new StringSelectMenuBuilder()
74+
const favoriteStarterSelect = new StringSelectMenuBuilder()
6775
.setCustomId('starter')
6876
.setPlaceholder('Make a selection!')
6977
.addOptions(
78+
// String select menu options
7079
new StringSelectMenuOptionBuilder()
80+
// Label displayed to user
7181
.setLabel('Bulbasaur')
82+
// Description of option
7283
.setDescription('The dual-type Grass/Poison Seed Pokémon.')
84+
// Value returned in select menu interaction
7385
.setValue('bulbasaur'),
7486
new StringSelectMenuOptionBuilder()
7587
.setLabel('Charmander')
@@ -81,9 +93,11 @@ module.exports = {
8193
.setValue('squirtle'),
8294
);
8395

84-
// [!code ++:6]
85-
const row = new ActionRowBuilder().addComponents(select);
96+
// [!code ++:8]
97+
// Adding a string select menu to an action row
98+
const row = new ActionRowBuilder().addComponents(favoriteStarterSelect);
8699

100+
// Reply with the action row
87101
await interaction.reply({
88102
content: 'Choose your starter!',
89103
components: [row],
@@ -99,7 +113,7 @@ module.exports = {
99113
components](../popular-topics/display-components) system.
100114
</Callout>
101115

102-
### String select menu options
116+
## String select menu options
103117

104118
String select menu options are custom-defined by the user, as shown in the example above. At a minimum, each option must have it's `label` and `value` defined. The label is shown to the user, while the value is included in the interaction sent to the bot.
105119

apps/guide/content/docs/legacy/popular-topics/display-components.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ Text Display components let you add markdown-formatted text to your message and
3232
Sending user and role mentions in text display components **will notify users and roles**! You can and should control
3333
mentions with the `allowedMentions` message option.
3434
</Callout>
35+
<Callout>
36+
Text display components can be used in modals. See the [modal guide](../interactions/modals#text-display) for usage.
37+
</Callout>
3538

3639
The example below shows how you can send a Text Display component in a channel.
3740

apps/guide/content/docs/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"pages": ["legacy", "voice"]
2+
"pages": ["legacy", "v15", "voice"]
33
}

0 commit comments

Comments
 (0)