make the log embeds more fancy

This commit is contained in:
Lee 2024-07-04 06:44:55 +01:00
parent 4148f6e05f
commit c31ec09e0f
2 changed files with 26 additions and 14 deletions

@ -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<LogType> 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();
}
}

@ -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<LogType> 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)