Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent;
import net.dv8tion.jda.api.exceptions.ErrorResponseException;
import net.dv8tion.jda.api.interactions.commands.build.Commands;
import net.dv8tion.jda.api.interactions.components.Modal;
import net.dv8tion.jda.api.interactions.components.text.TextInput;
import net.dv8tion.jda.api.interactions.components.text.TextInput.Builder;
import net.dv8tion.jda.api.interactions.components.text.TextInputStyle;
import net.dv8tion.jda.api.requests.ErrorResponse;
import net.dv8tion.jda.api.requests.RestAction;
import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder;
import net.dv8tion.jda.api.utils.messages.MessageCreateData;
Expand Down Expand Up @@ -133,7 +135,13 @@ public void onModalSubmitted(ModalInteractionEvent event, List<String> args) {
// Deleted messages cause retrieveMessageById to fail.
Consumer<Message> notHandledAction =
any -> transferFlow(event, channelId, authorId, messageId);
Consumer<Throwable> handledAction = any -> alreadyHandled(sourceChannel, helperForum);

Consumer<Throwable> handledAction = any -> {
if (any instanceof ErrorResponseException errorResponseException
&& errorResponseException.getErrorResponse() == ErrorResponse.UNKNOWN_MESSAGE) {
alreadyHandled(sourceChannel, helperForum);
}
};

event.getChannel().retrieveMessageById(messageId).queue(notHandledAction, handledAction);
}
Expand Down