Skip to content

Commit 6bcf9fa

Browse files
Update wiki for components v2 (#61)
* Fix example for modals in JDA 6.0 * Remove events-list.md * Update build workflow
1 parent 745a8f3 commit 6bcf9fa

File tree

3 files changed

+9
-227
lines changed

3 files changed

+9
-227
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ jobs:
77
deploy:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions/setup-python@v2
10+
- uses: actions/checkout@v5
11+
- uses: actions/setup-python@v6
1212
with:
1313
python-version: 3.x
1414
- run: pip install mkdocs-material

docs/introduction/events-list.md

Lines changed: 0 additions & 218 deletions
This file was deleted.

docs/using-jda/interactions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ Modals are pop-ups that appear in a user's Discord client.
575575

576576
![Example Modal](../assets/images/interactions/modal_example.png)
577577

578-
Similarly to messages, Modals can contain up to **5** ActionRows, although the only component that can be put inside Modals at the moment (`TextInput`) takes up a whole ActionRow.
578+
A modal usually consists of a list of `Label` components, each of which contain a labelled field such as `TextInput` or `StringSelectMenu`.
579579

580580
### Replying with a Modal
581581

@@ -586,20 +586,20 @@ Similarly to messages, Modals can contain up to **5** ActionRows, although the o
586586
@Override
587587
public void onSlashCommandInteraction(SlashCommandInteractionEvent event) {
588588
if (event.getName().equals("modmail")) {
589-
TextInput subject = TextInput.create("subject", "Subject", TextInputStyle.SHORT)
589+
TextInput subject = TextInput.create("subject", TextInputStyle.SHORT)
590590
.setPlaceholder("Subject of this ticket")
591591
.setMinLength(10)
592592
.setMaxLength(100) // or setRequiredRange(10, 100)
593593
.build();
594594

595-
TextInput body = TextInput.create("body", "Body", TextInputStyle.PARAGRAPH)
595+
TextInput body = TextInput.create("body", TextInputStyle.PARAGRAPH)
596596
.setPlaceholder("Your concerns go here")
597597
.setMinLength(30)
598598
.setMaxLength(1000)
599599
.build();
600600

601601
Modal modal = Modal.create("modmail", "Modmail")
602-
.addComponents(ActionRow.of(subject), ActionRow.of(body))
602+
.addComponents(Label.of("Subject", subject), Label.of("Body", body))
603603
.build();
604604

605605
event.replyModal(modal).queue();
@@ -612,20 +612,20 @@ Similarly to messages, Modals can contain up to **5** ActionRows, although the o
612612
object SupportCommand : ListenerAdapter() {
613613
override fun onSlashCommandInteraction(event: SlashCommandInteractionEvent) {
614614
if (event.name == "modmail") {
615-
val subject = TextInput.create("subject", "Subject", TextInputStyle.SHORT)
615+
val subject = TextInput.create("subject", TextInputStyle.SHORT)
616616
.setPlaceholder("Subject of this ticket")
617617
.setMinLength(10)
618618
.setMaxLength(100) // or setRequiredRange(10, 100)
619619
.build()
620620

621-
val body = TextInput.create("body", "Body", TextInputStyle.PARAGRAPH)
621+
val body = TextInput.create("body", TextInputStyle.PARAGRAPH)
622622
.setPlaceholder("Your concerns go here")
623623
.setMinLength(30)
624624
.setMaxLength(1000)
625625
.build()
626626

627627
val modal = Modal.create("modmail", "Modmail")
628-
.addComponents(ActionRow.of(subject), ActionRow.of(body))
628+
.addComponents(Label.of("Subject", subject), Label.of("Body", body))
629629
.build()
630630

631631
event.replyModal(modal).queue()

0 commit comments

Comments
 (0)