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 {
|
try {
|
||||||
// First try to locate the user in a guild
|
// First try to locate the user in a guild
|
||||||
Member member = null;
|
Member member = null;
|
||||||
for (Guild guild : jda.getGuilds()) {
|
try {
|
||||||
if ((member = guild.retrieveMemberById(snowflake).complete()) != null) {
|
for (Guild guild : jda.getGuilds()) {
|
||||||
break;
|
if ((member = guild.retrieveMemberById(snowflake).complete()) != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (ErrorResponseException ex) {
|
||||||
|
if (ex.getErrorCode() != 10007) {
|
||||||
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Then retrieve the user
|
// Then retrieve the user
|
||||||
|
Loading…
x
Reference in New Issue
Block a user