check if the guild is valid before getting it

This commit is contained in:
Lee 2024-06-27 21:34:31 +01:00
parent f0cc859585
commit 63fbe27754

@ -59,6 +59,9 @@ public class GuildService extends ListenerAdapter {
if (guilds.containsKey(id)) { if (guilds.containsKey(id)) {
return guilds.get(id); return guilds.get(id);
} }
if (DiscordService.JDA.getGuildById(id) == null) {
return null;
}
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
Optional<BatGuild> optionalGuild = guildRepository.findById(id); Optional<BatGuild> optionalGuild = guildRepository.findById(id);