From 831bc934b4cc741ea862bac6fb44e8192506c537 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 3 Jul 2024 23:07:50 +0100 Subject: [PATCH] cleanup voice logs --- .../logging/listeners/ChannelListener.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/features/logging/listeners/ChannelListener.java b/src/main/java/cc/fascinated/bat/features/logging/listeners/ChannelListener.java index 4416f14..1dbf1ec 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/listeners/ChannelListener.java +++ b/src/main/java/cc/fascinated/bat/features/logging/listeners/ChannelListener.java @@ -81,20 +81,14 @@ public class ChannelListener implements EventListener { lastVoiceChannel.remove(user); } log.info("User \"{}\" {} voice channel \"{}\" in guild \"{}\"", user.getId(), joined ? "joined" : "left", voiceChannel.getName(), guild.getName()); + String description = new EmbedDescriptionBuilder("User %s Voice Channel".formatted(joined ? "Joined" : "Left")) + .appendLine("User: %s".formatted(user.getDiscordUser().getAsMention()), true) + .appendLine("Channel: %s".formatted(voiceChannel.getName()), true) + .build(); if (joined) { - logFeature.sendLog(guild, LogType.VOICE_CHANNEL_JOIN, EmbedUtils.successEmbed() - .setDescription(new EmbedDescriptionBuilder("User Joined Voice Channel") - .appendLine("User: %s".formatted(user.getDiscordUser().getAsMention()), true) - .appendLine("Channel: %s".formatted(voiceChannel.getName()), true) - .build()) - .build()); + logFeature.sendLog(guild, LogType.VOICE_CHANNEL_JOIN, EmbedUtils.successEmbed().setDescription(description).build()); return; } - logFeature.sendLog(guild, LogType.VOICE_CHANNEL_LEAVE, EmbedUtils.errorEmbed() - .setDescription(new EmbedDescriptionBuilder("User Left Voice Channel") - .appendLine("User: %s".formatted(user.getDiscordUser().getAsMention()), true) - .appendLine("Channel: %s".formatted(voiceChannel.getName()), true) - .build()) - .build()); + logFeature.sendLog(guild, LogType.VOICE_CHANNEL_LEAVE, EmbedUtils.errorEmbed().setDescription(description).build()); } }