use of sx.blah.discord.api.internal.json.objects.UserObject in project Discord4J by Discord4J.
the class Reaction method getUsers.
@Override
public List<IUser> getUsers() {
List<IUser> users = new ArrayList<>();
String emoji = getEmoji().isUnicode() ? getEmoji().getName() : getEmoji().getName() + ":" + getEmoji().getStringID();
String endpoint = String.format(DiscordEndpoints.REACTIONS_USER_LIST, getMessage().getChannel().getStringID(), getMessage().getStringID(), emoji);
String after = "0";
while (users.size() < count) {
UserObject[] json = ((DiscordClientImpl) getClient()).REQUESTS.GET.makeRequest(endpoint + "?after=" + after + "&limit=100", UserObject[].class);
for (UserObject obj : json) {
users.add(getMessage().getShard().getUserByID(Long.parseUnsignedLong(obj.id)));
}
// Temporary measure so a refactor can be applied later.
if (json.length == 0)
break;
after = json[json.length - 1].id;
}
return users;
}
Aggregations