From 1028dca15a667d66956b23793e8eb4813a0ab819 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 2 Jul 2024 18:36:17 +0100 Subject: [PATCH] add more data to the logs --- .../bat/features/logging/listeners/MemberListener.java | 2 ++ .../bat/features/logging/listeners/MessageListener.java | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java b/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java index 84df8dc..edb7b80 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java +++ b/src/main/java/cc/fascinated/bat/features/logging/listeners/MemberListener.java @@ -33,6 +33,7 @@ public class MemberListener implements EventListener { logFeature.sendLog(guild, LogType.MEMBER_JOIN, EmbedUtils.successEmbed() .setDescription(new EmbedDescriptionBuilder("Member Joined") .appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true) + .appendLine("Username: %s".formatted(user.getDiscordUser().getName()), true) .appendLine("Snowflake: %s".formatted(user.getId()), true) .build()) .build()); @@ -45,6 +46,7 @@ public class MemberListener implements EventListener { logFeature.sendLog(guild, LogType.MEMBER_LEAVE, EmbedUtils.errorEmbed() .setDescription(new EmbedDescriptionBuilder("Member Left") .appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true) + .appendLine("Username: %s".formatted(user.getDiscordUser().getName()), true) .appendLine("Snowflake: %s".formatted(user.getId()), true) .build()) .build()); diff --git a/src/main/java/cc/fascinated/bat/features/logging/listeners/MessageListener.java b/src/main/java/cc/fascinated/bat/features/logging/listeners/MessageListener.java index ee25413..6debfa9 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/listeners/MessageListener.java +++ b/src/main/java/cc/fascinated/bat/features/logging/listeners/MessageListener.java @@ -9,6 +9,7 @@ import cc.fascinated.bat.model.BatGuild; import cc.fascinated.bat.model.BatUser; import cc.fascinated.bat.model.DiscordMessage; import lombok.NonNull; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.message.MessageDeleteEvent; import net.dv8tion.jda.api.events.message.MessageUpdateEvent; import org.springframework.beans.factory.annotation.Autowired; @@ -31,10 +32,11 @@ public class MessageListener implements EventListener { public void onGuildMessageDelete(@NonNull BatGuild guild, BatUser user, DiscordMessage message, @NonNull MessageDeleteEvent event) { if (user.getDiscordUser().isBot() || message.getAuthor().isBot()) return; + TextChannel channel = message.getChannel(); logFeature.sendLog(guild, LogType.MESSAGE_DELETE, EmbedUtils.errorEmbed() .setDescription(new EmbedDescriptionBuilder("Message Deleted") .appendLine("Author: %s (%s)".formatted(message.getAuthor().getAsMention(), message.getAuthor().getId()), true) - .appendLine("Channel: %s".formatted(message.getChannel().getAsMention()), true) + .appendLine("Channel: %s (%s)".formatted(channel.getAsMention(), channel.getName()), true) .appendLine("Content: %s".formatted(logFeature.formatContent(message.getContent())), true) .build()) .build()); @@ -45,10 +47,11 @@ public class MessageListener implements EventListener { @NonNull DiscordMessage newMessage, @NonNull MessageUpdateEvent event) { if (user.getDiscordUser().isBot() || newMessage.getAuthor().isBot() || oldMessage == null) return; + TextChannel channel = newMessage.getChannel(); logFeature.sendLog(guild, LogType.MESSAGE_EDIT, EmbedUtils.genericEmbed() .setDescription(new EmbedDescriptionBuilder("Message Edited") .appendLine("Author: %s (%s)".formatted(newMessage.getAuthor().getAsMention(), newMessage.getAuthor().getId()), true) - .appendLine("Channel: %s".formatted(newMessage.getChannel().getAsMention()), true) + .appendLine("Channel: %s (%s)".formatted(channel.getAsMention(), channel.getName()), true) .appendLine("Old Content: %s".formatted(logFeature.formatContent(oldMessage.getContent())), true) .appendLine("New Content: %s".formatted(logFeature.formatContent(newMessage.getContent())), true) .build())