forked from Fascinated/Bat
add valid guild and user id check
This commit is contained in:
parent
b1785ce373
commit
a001f2dd4c
@ -74,6 +74,10 @@ public class GuildService extends ListenerAdapter implements EventListener {
|
||||
if (guilds.containsKey(id)) {
|
||||
return guilds.get(id);
|
||||
}
|
||||
if (DiscordService.JDA.getGuildById(id) == null) {
|
||||
log.warn("Attempted to get guild with ID \"{}\" but it does not exist", id);
|
||||
return null;
|
||||
}
|
||||
// Guild is not cached
|
||||
Document document = MongoService.INSTANCE.getGuildsCollection().find(Filters.eq("_id", id)).first();
|
||||
if (document != null) {
|
||||
|
@ -54,6 +54,10 @@ public class UserService implements EventListener {
|
||||
if (users.containsKey(id)) {
|
||||
return users.get(id);
|
||||
}
|
||||
if (DiscordService.JDA.getUserById(id) == null) {
|
||||
log.warn("Attempted to get user with ID \"{}\" but it does not exist", id);
|
||||
return null;
|
||||
}
|
||||
// User is not cached
|
||||
Document document = MongoService.INSTANCE.getUsersCollection().find(Filters.eq("_id", id)).first();
|
||||
if (document != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user