From 83250d2c0893f2545a092686d363c9f0e58d2287 Mon Sep 17 00:00:00 2001 From: Liam Date: Wed, 3 Jul 2024 01:59:53 +0100 Subject: [PATCH] add check to see if the member is in the guild before logging some events --- .../bat/features/logging/listeners/MemberListener.java | 3 +++ 1 file changed, 3 insertions(+) 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 3fc8d79..2000794 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 @@ -89,6 +89,7 @@ public class MemberListener implements EventListener { for (Guild guild : DiscordService.JDA.getGuilds()) { BatGuild batGuild = guildService.getGuild(guild.getId()); if (batGuild == null) continue; + if (!guild.isMember(user.getDiscordUser())) continue; // User is not in the guild logFeature.sendLog(batGuild, LogType.MEMBER_GLOBAL_NAME_UPDATE, EmbedUtils.genericEmbed() .setDescription(new EmbedDescriptionBuilder("Member Name Updated") @@ -106,6 +107,7 @@ public class MemberListener implements EventListener { for (Guild guild : DiscordService.JDA.getGuilds()) { BatGuild batGuild = guildService.getGuild(guild.getId()); if (batGuild == null) continue; + if (!guild.isMember(user.getDiscordUser())) continue; // User is not in the guild logFeature.sendLog(batGuild, LogType.MEMBER_USERNAME_UPDATE, EmbedUtils.genericEmbed() .setDescription(new EmbedDescriptionBuilder("Member Username Updated") @@ -123,6 +125,7 @@ public class MemberListener implements EventListener { for (Guild guild : DiscordService.JDA.getGuilds()) { BatGuild batGuild = guildService.getGuild(guild.getId()); if (batGuild == null) continue; + if (!guild.isMember(user.getDiscordUser())) continue; // User is not in the guild logFeature.sendLog(batGuild, LogType.MEMBER_USERNAME_UPDATE, EmbedUtils.genericEmbed() .setDescription(new EmbedDescriptionBuilder("Member Avatar Updated")