Skip to content

Commit 3a1e0f4

Browse files
committed
Remove modal example from Modals in favor of wiki
1 parent f3b839d commit 3a1e0f4

File tree

3 files changed

+1
-286
lines changed

3 files changed

+1
-286
lines changed

BotCommands-core/src/javaDocExamples/java/doc/java/examples/commands/slash/SlashRequestRole.java

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

BotCommands-core/src/kotlinDocExamples/kotlin/doc/kotlin/examples/commands/slash/SlashRequestRole.kt

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

BotCommands-core/src/main/kotlin/io/github/freya022/botcommands/api/modals/Modals.kt

Lines changed: 1 addition & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -15,134 +15,7 @@ import kotlin.time.toKotlinDuration
1515
/**
1616
* Methods for modals and modal inputs
1717
*
18-
* ### Kotlin example
19-
* ```kotlin
20-
* private const val MODAL_NAME = "request role"
21-
* private const val INPUT_REASON = "reason"
22-
* private const val INPUT_ROLE = "role"
23-
* private const val INPUT_DETAILS = "details"
24-
*
25-
* @Command
26-
* class SlashRequestRole(private val modals: Modals) {
27-
*
28-
* @JDASlashCommand(name = "request_role", description = "Request a role")
29-
* fun onSlashRequestRole(event: GuildSlashEvent) {
30-
* val modal = modals.create("Role Request Form") {
31-
* text(
32-
* """
33-
* ### Welcome!
34-
* Please read the following before continuing:
35-
* 1. Select the role you wish to get
36-
* 2. Select the reason why you want this role
37-
* 3. (Optional) Add any detail about your request
38-
*
39-
* -# Abuse of this system may result in penalties
40-
* """.trimIndent()
41-
* )
42-
*
43-
* label("Role") {
44-
* child = EntitySelectMenu(INPUT_ROLE, SelectTarget.ROLE)
45-
* }
46-
*
47-
* label("Reason") {
48-
* child = StringSelectMenu(INPUT_REASON) {
49-
* option("It looks cool!", "cool")
50-
* option("I like the color", "color")
51-
* option("I am interested in the relevant discussions", "discussions")
52-
* }
53-
* }
54-
*
55-
* label("Details") {
56-
* child = TextInput(INPUT_DETAILS, TextInputStyle.PARAGRAPH, isRequired = false)
57-
* }
58-
*
59-
* bindTo(MODAL_NAME)
60-
* }
61-
*
62-
* event.replyModal(modal).queue()
63-
* }
64-
*
65-
* @ModalHandler(MODAL_NAME)
66-
* fun onRequestRoleModal(
67-
* event: ModalEvent,
68-
* @ModalInput(INPUT_REASON) reason: List<String>,
69-
* @ModalInput(INPUT_ROLE) roles: List<Role>,
70-
* @ModalInput(INPUT_DETAILS) details: String,
71-
* ) {
72-
* event.reply("Your request has been submitted!")
73-
* .setEphemeral(true)
74-
* .queue()
75-
* }
76-
* }
77-
* ```
78-
*
79-
* ### Java example
80-
* ```java
81-
* @Command
82-
* public class SlashRequestRole {
83-
*
84-
* private static final String MODAL_NAME = "request role";
85-
* private static final String INPUT_ROLE = "role";
86-
* private static final String INPUT_REASON = "reason";
87-
* private static final String INPUT_DETAILS = "details";
88-
*
89-
* private final Modals modals;
90-
*
91-
* public SlashRequestRole(Modals modals) {
92-
* this.modals = modals;
93-
* }
94-
*
95-
* @JDASlashCommand(name = "request_role", description = "Request a role")
96-
* public void onSlashRequestRole(GuildSlashEvent event) {
97-
* var modal = modals.create("Role Request Form")
98-
* .addComponents(
99-
* TextDisplay.of("""
100-
* ### Welcome!
101-
* Please read the following before continuing:
102-
* 1. Select the role you wish to get
103-
* 2. Select the reason why you want this role
104-
* 3. (Optional) Add any detail about your request
105-
*
106-
* -# Abuse of this system may result in penalties
107-
* """),
108-
* Label.of(
109-
* "Role",
110-
* EntitySelectMenu.create(INPUT_ROLE, SelectTarget.ROLE).build()
111-
* ),
112-
* Label.of(
113-
* "Reason",
114-
* StringSelectMenu.create(INPUT_REASON)
115-
* .addOption("It looks cool!", "cool")
116-
* .addOption("I like the color", "color")
117-
* .addOption("I am interested in the relevant discussions", "discussions")
118-
* .build()
119-
* ),
120-
* Label.of(
121-
* "Details",
122-
* TextInput.create(INPUT_DETAILS, TextInputStyle.PARAGRAPH)
123-
* .setRequired(false)
124-
* .build()
125-
* )
126-
* )
127-
* .bindTo(MODAL_NAME)
128-
* .build();
129-
*
130-
* event.replyModal(modal).queue();
131-
* }
132-
*
133-
* @ModalHandler(MODAL_NAME)
134-
* public void onRequestRoleModal(
135-
* ModalEvent event,
136-
* @ModalInput(INPUT_ROLE) List<Role> roles,
137-
* @ModalInput(INPUT_REASON) List<String> reason,
138-
* @ModalInput(INPUT_DETAILS) String details
139-
* ) {
140-
* event.reply("Your request has been submitted!")
141-
* .setEphemeral(true)
142-
* .queue();
143-
* }
144-
* }
145-
* ```
18+
* More details available on the [wiki](https://bc.freya02.dev/3.X/using-modals).
14619
*/
14720
@InterfacedService(acceptMultiple = false)
14821
interface Modals {

0 commit comments

Comments
 (0)