update interaction error message

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());
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();
}
return EmbedUtils.errorEmbed()
EmbedBuilder embed = errorEmbed()
.setDescription("""
An error has occurred while processing your interaction. Please check the logs for more information.
```java
%s
```""".formatted(ex.getLocalizedMessage()));
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(embed.build()).queue();
}
return embed;
}
}