use of net.dv8tion.jda.core.utils.cache.MemberCacheView in project SkyBot by duncte123.
the class GuildUtils method getBotAndUserCount.
/**
* Returns an array with the member counts of the guild
* 0 = the total users
* 1 = the total bots
* 3 = the total members
*
* @param g The {@link Guild Guild} to count the users in
* @return an array with the member counts of the guild
*/
public static long[] getBotAndUserCount(Guild g) {
MemberCacheView memberCache = g.getMemberCache();
long totalCount = memberCache.size();
long botCount = memberCache.stream().filter(it -> it.getUser().isBot()).count();
long userCount = totalCount - botCount;
return new long[] { userCount, botCount, totalCount };
}
Aggregations