add valid guild and user id check
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 38s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 38s
This commit is contained in:
parent
b1785ce373
commit
a001f2dd4c
@ -74,6 +74,10 @@ public class GuildService extends ListenerAdapter implements EventListener {
|
|||||||
if (guilds.containsKey(id)) {
|
if (guilds.containsKey(id)) {
|
||||||
return guilds.get(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
|
// Guild is not cached
|
||||||
Document document = MongoService.INSTANCE.getGuildsCollection().find(Filters.eq("_id", id)).first();
|
Document document = MongoService.INSTANCE.getGuildsCollection().find(Filters.eq("_id", id)).first();
|
||||||
if (document != null) {
|
if (document != null) {
|
||||||
|
@ -54,6 +54,10 @@ public class UserService implements EventListener {
|
|||||||
if (users.containsKey(id)) {
|
if (users.containsKey(id)) {
|
||||||
return users.get(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
|
// User is not cached
|
||||||
Document document = MongoService.INSTANCE.getUsersCollection().find(Filters.eq("_id", id)).first();
|
Document document = MongoService.INSTANCE.getUsersCollection().find(Filters.eq("_id", id)).first();
|
||||||
if (document != null) {
|
if (document != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user