forked from Fascinated/Bat
update interaction error message
This commit is contained in:
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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user