use of com.patreon.resources.Campaign in project DiscordSailv2 by Vaerys-Dawn.
the class Client method checkPatrons.
public static void checkPatrons() {
if (!checkPatreonIsValid())
return;
List<Long> patronIDs = new ArrayList<>();
try {
if (patreonApi == null)
return;
List<Campaign> campaigns = patreonApi.fetchCampaigns().get();
for (Campaign c : campaigns) {
List<Pledge> pledges = patreonApi.fetchAllPledges(c.getId());
if (pledges != null) {
for (Pledge p : pledges) {
if (p.getReward().getTitle().equalsIgnoreCase("Pioneer")) {
try {
long userID = Long.parseUnsignedLong(p.getPatron().getSocialConnections().getDiscord().getUser_id());
patronIDs.add(userID);
} catch (NumberFormatException e) {
// skip
}
}
}
}
}
logger.info("Patron List Updated.");
} catch (IOException e) {
// nothing happens
}
Globals.setPatrons(patronIDs);
}
Aggregations