#Problem with JDA

6 messages · Page 1 of 1 (latest)

rapid aspen
#

So i'm trying to make ticket bot with modals, but I keep getting: java.lang.IllegalStateException: This interaction has already been acknowledged or replied to. You can only reply or acknowledge an interaction once!

I've never worked with modals before so I have no idea how to fix it

midnight hareBOT
#

This post has been reserved for your question.

Hey @rapid aspen! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

rapid aspen
#

here's code:

@Override
    public void onButtonInteraction(ButtonInteractionEvent e) {
        if (e.getComponentId().equalsIgnoreCase("ticketID")) {
            TextInput nick = TextInput.create("ticket-nick", "Nick", TextInputStyle.SHORT)
                    .setPlaceholder("Discord Nickname")
                    .setMinLength(3)
                    .setMaxLength(24)
                    .setRequired(true)
                    .build();
            TextInput problem = TextInput.create("ticket-problem", "Problem", TextInputStyle.PARAGRAPH)
                    .setPlaceholder("Describe problem..")
                    .setMinLength(16)
                    .setMaxLength(512)
                    .setRequired(true)
                    .build();
            Modal ticket = Modal.create("ticket", "Ticket " + Objects.requireNonNull(e.getMember()).getUser().getAsTag())
                    .addActionRows(ActionRow.of(nick), ActionRow.of(problem))
                    .build();

            e.replyModal(ticket).queue(); // error in this line (i think)
        }

        if (e.getComponentId().equalsIgnoreCase("closeTicketID")) {
            e.getChannel().delete().queueAfter(3L, TimeUnit.SECONDS);
            e.reply("Ticket was closed").queueAfter(3L, TimeUnit.SECONDS);
        }
    }```
cursive chasm
#

are you listening to button interactions elsewhere?

rapid aspen