From c31ec09e0f1800de7eaf352a9e7d5a8dbbafc876 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 4 Jul 2024 06:44:55 +0100 Subject: [PATCH] make the log embeds more fancy --- .../logging/command/RemoveSubCommand.java | 19 ++++++++++------- .../logging/command/SetSubCommand.java | 21 ++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/features/logging/command/RemoveSubCommand.java b/src/main/java/cc/fascinated/bat/features/logging/command/RemoveSubCommand.java index faec58d..a28033d 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/command/RemoveSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/logging/command/RemoveSubCommand.java @@ -1,5 +1,6 @@ package cc.fascinated.bat.features.logging.command; +import cc.fascinated.bat.Emojis; import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.common.EmbedDescriptionBuilder; @@ -45,7 +46,7 @@ public class RemoveSubCommand extends BatSubCommand { } event.replyEmbeds(EmbedUtils.successEmbed() - .setDescription("Successfully removed the log channel for all log types") + .setDescription("%s Successfully removed the log channel for all log types".formatted(Emojis.CHECK_MARK_EMOJI)) .build()).queue(); return; } @@ -54,9 +55,11 @@ public class RemoveSubCommand extends BatSubCommand { LogCategory logCategory = LogCategory.getLogCategory(type); if (logCategory != null) { List category = LogType.getLogTypesByCategory(type); - EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Log Channel"); - description.appendLine("Successfully removed the log channel for the `%s` category" - .formatted(logCategory.getName()), false); + EmbedDescriptionBuilder description = new EmbedDescriptionBuilder(null); + description.appendLine("%s Successfully removed the log channel for the `%s` category".formatted( + Emojis.CHECK_MARK_EMOJI, + logCategory.getName() + ), false); description.emptyLine(); int removed = 0; @@ -79,7 +82,7 @@ public class RemoveSubCommand extends BatSubCommand { LogType logType = LogType.getLogType(type); if (logType == null) { event.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("Invalid log type") + .setDescription("%s Invalid log type".formatted(Emojis.CROSS_MARK_EMOJI)) .build()).queue(); return; } @@ -92,7 +95,9 @@ public class RemoveSubCommand extends BatSubCommand { } profile.removeLogChannel(logType); event.replyEmbeds(EmbedUtils.successEmbed() - .setDescription("Successfully removed the log channel for `%s`".formatted(logType.getName())) - .build()).queue(); + .setDescription("%s Successfully removed the log channel for `%s`".formatted( + Emojis.CHECK_MARK_EMOJI, + logType.getName() + )).build()).queue(); } } diff --git a/src/main/java/cc/fascinated/bat/features/logging/command/SetSubCommand.java b/src/main/java/cc/fascinated/bat/features/logging/command/SetSubCommand.java index 336a9cc..76f8316 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/command/SetSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/logging/command/SetSubCommand.java @@ -1,5 +1,6 @@ package cc.fascinated.bat.features.logging.command; +import cc.fascinated.bat.Emojis; import cc.fascinated.bat.command.BatSubCommand; import cc.fascinated.bat.command.CommandInfo; import cc.fascinated.bat.common.EmbedDescriptionBuilder; @@ -50,8 +51,12 @@ public class SetSubCommand extends BatSubCommand { for (LogType logType : LogType.values()) { profile.setLogChannel(logType, targetChannel); } - EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Log Channel"); - description.appendLine("Successfully set the log channel for %s log events to %s".formatted(LogType.values().length, targetChannel.getAsMention()), false); + EmbedDescriptionBuilder description = new EmbedDescriptionBuilder(null); + description.appendLine("%s Successfully set the log channel for %s log events to %s".formatted( + Emojis.CHECK_MARK_EMOJI, + LogType.values().length, + targetChannel.getAsMention() + ), false); description.emptyLine(); description.appendLine("*To view the current log channels, use `/logs list`*", false); event.replyEmbeds(EmbedUtils.successEmbed().setDescription(description.build()).build()).queue(); @@ -62,8 +67,9 @@ public class SetSubCommand extends BatSubCommand { LogCategory logCategory = LogCategory.getLogCategory(type); if (logCategory != null) { List category = LogType.getLogTypesByCategory(type); - EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Log Channel"); - description.appendLine("Successfully set the log channel for %s %s log events to %s".formatted( + EmbedDescriptionBuilder description = new EmbedDescriptionBuilder(null); + description.appendLine("%s Successfully set the log channel for %s %s log events to %s".formatted( + Emojis.CHECK_MARK_EMOJI, category.size(), logCategory.getName(), targetChannel.getAsMention() @@ -80,13 +86,14 @@ public class SetSubCommand extends BatSubCommand { LogType logType = LogType.getLogType(type); if (logType == null) { event.replyEmbeds(EmbedUtils.errorEmbed() - .setDescription("Invalid log type") + .setDescription("%s Invalid log type".formatted(Emojis.CROSS_MARK_EMOJI)) .build()).queue(); return; } profile.setLogChannel(logType, targetChannel); - event.replyEmbeds(EmbedUtils.successEmbed().setDescription(new EmbedDescriptionBuilder("Log Channel") - .appendLine("Successfully set the log channel for %s to %s".formatted( + event.replyEmbeds(EmbedUtils.successEmbed().setDescription(new EmbedDescriptionBuilder(null) + .appendLine("%s Successfully set the log channel for %s to %s".formatted( + Emojis.CHECK_MARK_EMOJI, logType.getName(), targetChannel.getAsMention() ), false)