update interaction error message
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 1m6s

This commit is contained in:
Lee 2024-07-05 23:35:41 +01:00
parent 07c5a7358b
commit ec54d5427e

@ -48,25 +48,26 @@ public class EmbedUtils {
/**
* Builds a generic interaction error embed
*
* @param ex the exception
* @param ex the exceptionk
* @return the embed builder
*/
public static EmbedBuilder genericInteractionError(Exception ex) {
TextChannel channel = ChannelUtils.getTextChannel(Config.INSTANCE.getLogsChannel());
EmbedBuilder embed = errorEmbed()
.setDescription("""
An error has occurred while processing %s interaction. If this issue persists, please contact the developers.
Cause: `%s`
```java
%s
```""".formatted(
channel == null ? "an" : "your",
ex.getStackTrace()[0].getClassName(),
ex.getLocalizedMessage()
));
if (channel != null) {
channel.sendMessageEmbeds(EmbedUtils.errorEmbed()
.setDescription("""
An error has occurred while processing an interaction. Please check the logs for more information.
```java
%s
```""".formatted(ex.getLocalizedMessage()))
.build()).queue();
channel.sendMessageEmbeds(embed.build()).queue();
}
return EmbedUtils.errorEmbed()
.setDescription("""
An error has occurred while processing your interaction. Please check the logs for more information.
```java
%s
```""".formatted(ex.getLocalizedMessage()));
return embed;
}
}