Skip to content

Commit 4de4681

Browse files
committed
feat: Added opening a modal with a select menu event
1 parent 0959f61 commit 4de4681

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/main/java/com/seailz/jdaframework/modals/Modal.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
88
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
99
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
10+
import net.dv8tion.jda.api.events.interaction.component.SelectMenuInteractionEvent;
1011
import net.dv8tion.jda.api.interactions.components.ItemComponent;
1112
import net.dv8tion.jda.api.interactions.modals.ModalMapping;
1213

@@ -66,6 +67,15 @@ public void open(Member member, SlashCommandInteractionEvent interaction) {
6667
ModalManager.open(this, member, interaction);
6768
}
6869

70+
/**
71+
* Opens the modal
72+
* @param member The member to show the modal to
73+
* @param interaction The interaction to reply to
74+
*/
75+
public void open(Member member, SelectMenuInteractionEvent interaction) {
76+
ModalManager.open(this, member, interaction);
77+
}
78+
6979
/**
7080
* Selects the method to be called when the modal is submitted.
7181
* @param onSubmit The method to be called when the modal is submitted.

src/main/java/com/seailz/jdaframework/select/SelectMenuManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
public class SelectMenuManager {
99

10+
/**
11+
* Listen for a select menu to be interacted with
12+
* @param id The id of the select menu
13+
* @param onClick The action to perform when the select menu is interacted with
14+
*/
1015
public static void listen(String id, Consumer<SelectMenuInteractionEvent> onClick) {
1116
DiscordBot.getSelectRegistry().put(id, onClick);
1217
}

0 commit comments

Comments
 (0)