forked from Fascinated/Bat
use generic embed for interaction errors
This commit is contained in:
@ -147,14 +147,9 @@ public class EventService extends ListenerAdapter {
|
||||
for (EventListener listener : LISTENERS) {
|
||||
listener.onButtonInteraction(guild, user, event);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("An error occurred while handling a modal interaction.", e);
|
||||
if (event.isAcknowledged()) {
|
||||
return;
|
||||
}
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
.setDescription("An error occurred while handling your interaction.\nError: ```java\n%s\n```".formatted(e.getMessage()))
|
||||
.build()).queue();
|
||||
} catch (Exception ex) {
|
||||
log.error("An error occurred while handling a modal interaction.", ex);
|
||||
event.replyEmbeds(EmbedUtils.genericInteractionError(ex).build()).setEphemeral(true).queue();
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,14 +165,9 @@ public class EventService extends ListenerAdapter {
|
||||
for (EventListener listener : LISTENERS) {
|
||||
listener.onModalInteraction(guild, user, event);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("An error occurred while handling a modal interaction.", e);
|
||||
if (event.isAcknowledged()) {
|
||||
return;
|
||||
}
|
||||
event.replyEmbeds(EmbedUtils.errorEmbed()
|
||||
.setDescription("An error occurred while handling your interaction.\nError: ```java\n%s\n```".formatted(e.getMessage()))
|
||||
.build()).queue();
|
||||
} catch (Exception ex) {
|
||||
log.error("An error occurred while handling a modal interaction.", ex);
|
||||
event.replyEmbeds(EmbedUtils.genericInteractionError(ex).build()).setEphemeral(true).queue();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user