Fix not being able to lookup users who aren't in the guild
All checks were successful
Deploy API / docker (ubuntu-latest, 2.44.0) (push) Successful in 55s
All checks were successful
Deploy API / docker (ubuntu-latest, 2.44.0) (push) Successful in 55s
This commit is contained in:
parent
b00694ecf8
commit
2785048de8
@ -74,9 +74,15 @@ public final class DiscordService {
|
||||
try {
|
||||
// First try to locate the user in a guild
|
||||
Member member = null;
|
||||
for (Guild guild : jda.getGuilds()) {
|
||||
if ((member = guild.retrieveMemberById(snowflake).complete()) != null) {
|
||||
break;
|
||||
try {
|
||||
for (Guild guild : jda.getGuilds()) {
|
||||
if ((member = guild.retrieveMemberById(snowflake).complete()) != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ErrorResponseException ex) {
|
||||
if (ex.getErrorCode() != 10007) {
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
// Then retrieve the user
|
||||
|
Loading…
x
Reference in New Issue
Block a user