Reputation: 1
im using first time discord modals (slash commands) on JDA. When I export the bot and turn it on, the commands appear under / (slash commands) they do not work, it shows "The application is not responding"
JDA jda = JDABuilder.createDefault(token)
.setActivity(Activity.listening("TEST"))
.addEventListeners(new TestCommand())
.build().awaitReady();
Guild guild = jda.getGuildById("SERVER_ID");
if (guild != null){
guild.upsertCommand("test", "test command").queue();
}
TestCommand
@Override
public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) {
if (event.getName().equals("test")){
TextInput test_name = TextInput.create("test-name", "Name", TextInputStyle.SHORT)
.setPlaceholder("test text")
.setMinLength(1)
.setRequired(true)
.build();
TextInput message = TextInput.create("test-message","Message", TextInputStyle.PARAGRAPH)
.setMinLength(10)
.setMaxLength(100)
.setRequired(true)
.setValue("test text.")
.build();
Modal modal = Modal.create("test-modal", "test text")
.addActionRows(ActionRow.of(name), ActionRow.of(message))
.build();
event.replyModal(modal).queue();
If turn it on IntelliJ debug mode and enable the bot without exporting, the slash commands / work normally.
Upvotes: 0
Views: 1056
Reputation: 1
Change for this:
Modal modal = Modal.create("test-modal", "test text")
.addActionRows(ActionRow.of(test_name), ActionRow.of(message))
.build();
Upvotes: 0