From 4a522c084deed9ce303127e86b7c68c349bdf5e5 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 4 Jul 2024 06:21:31 +0100 Subject: [PATCH] add emojis to the log category buttons and add a home button --- src/main/java/cc/fascinated/bat/Emojis.java | 2 + .../bat/features/logging/LogCategory.java | 23 +++++--- .../logging/command/ListSubCommand.java | 54 +++++++++++++------ 3 files changed, 57 insertions(+), 22 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/Emojis.java b/src/main/java/cc/fascinated/bat/Emojis.java index 84b52e0..b66fe3d 100644 --- a/src/main/java/cc/fascinated/bat/Emojis.java +++ b/src/main/java/cc/fascinated/bat/Emojis.java @@ -17,6 +17,7 @@ public class Emojis { public static final Emoji PAUSE_EMOJI; public static final Emoji PLAY_EMOJI; public static final Emoji SKIP_EMOJI; + public static final Emoji HOME_EMOJI; /** * Presence Status Emojis @@ -40,6 +41,7 @@ public class Emojis { PAUSE_EMOJI = Emoji.fromUnicode("⏸"); PLAY_EMOJI = Emoji.fromUnicode("▶"); SKIP_EMOJI = Emoji.fromUnicode("⏭"); + HOME_EMOJI = Emoji.fromUnicode("🏠"); log.info("Loaded emojis!"); } } diff --git a/src/main/java/cc/fascinated/bat/features/logging/LogCategory.java b/src/main/java/cc/fascinated/bat/features/logging/LogCategory.java index 875823c..f5d94a8 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/LogCategory.java +++ b/src/main/java/cc/fascinated/bat/features/logging/LogCategory.java @@ -1,22 +1,33 @@ package cc.fascinated.bat.features.logging; +import cc.fascinated.bat.common.EnumUtils; import lombok.AllArgsConstructor; import lombok.Getter; +import net.dv8tion.jda.api.entities.emoji.Emoji; /** * @author Fascinated (fascinated7) */ @AllArgsConstructor @Getter public enum LogCategory { - MESSAGE("Message"), - MEMBER("Member"), - CHANNEL("Channel"), - GUILD("Guild"); + MESSAGE(Emoji.fromUnicode("📩")), + MEMBER(Emoji.fromUnicode("👤")), + CHANNEL(Emoji.fromUnicode("📺")), + GUILD(Emoji.fromUnicode("🏰")); /** - * The name of the log category + * The emoji of the log category */ - private final String name; + private final Emoji emoji; + + /** + * Gets the name of the log category + * + * @return the name + */ + public String getName() { + return EnumUtils.getEnumName(this); + } /** * Gets the log category by the name diff --git a/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java b/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java index 7e9ebc6..1d6ef20 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.java +++ b/src/main/java/cc/fascinated/bat/features/logging/command/ListSubCommand.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; @@ -12,6 +13,7 @@ import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatUser; import lombok.NonNull; import net.dv8tion.jda.api.entities.Member; +import net.dv8tion.jda.api.entities.MessageEmbed; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel; import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent; @@ -32,30 +34,31 @@ public class ListSubCommand extends BatSubCommand implements EventListener { @Override public void execute(BatGuild guild, @NonNull BatUser user, @NonNull MessageChannel channel, Member member, @NonNull SlashCommandInteraction event) { List