fix embed color

This commit is contained in:
Lee 2024-07-03 22:18:35 +01:00
parent 642185f8c5
commit 655662c6f8

@ -46,6 +46,9 @@ public class EmbedSubCommand extends BatSubCommand {
String color = colorOption.getAsString(); String color = colorOption.getAsString();
boolean pingBeforeSend = pingBeforeSendOption.getAsBoolean(); boolean pingBeforeSend = pingBeforeSendOption.getAsBoolean();
// Remove # if the user added it
color = color.replace("#", "");
// Validate the input // Validate the input
if (color.length() != 6 || Color.decode("#" + color).getRGB() == -1){ if (color.length() != 6 || Color.decode("#" + color).getRGB() == -1){
event.replyEmbeds(EmbedUtils.errorEmbed() event.replyEmbeds(EmbedUtils.errorEmbed()
@ -67,7 +70,6 @@ public class EmbedSubCommand extends BatSubCommand {
return; return;
} }
color = color.replace("#", ""); // Remove # if the user added it
boolean isMessageEnabled = profile.isMessage(); boolean isMessageEnabled = profile.isMessage();
profile.setEmbed(title, description, color, pingBeforeSend); profile.setEmbed(title, description, color, pingBeforeSend);
EmbedDescriptionBuilder successDescription = new EmbedDescriptionBuilder("Welcomer Embed") EmbedDescriptionBuilder successDescription = new EmbedDescriptionBuilder("Welcomer Embed")