Create a function that puts the number of users in a certain server id or all servers combined of a server bot into a into basically a int required function that gathers the number of users in a server or a total number of servers #1667
Unanswered
MasterScary
asked this question in
Questions and Help
Create a function that puts the number of users in a certain server id or all servers combined of a server bot into a into basically a int required function that gathers the number of users in a server or a total number of servers
#1667
Replies
|
Please ask in the JDA Discord next time, as we could've answered this question fairly easy. In general, there are more than enough ways to get specific values such as total amount of members or from specific guilds. Here are two examples I quickly made. JDA jda = JDABuilder.createDefault("S3cretT0k3n")
.enableIntents(GatewayIntent.GUILD_MEMBERS) // Those are required to get Guild members
.setChunkingFilter(ChunkingFilter.ALL)
.setMemberCachePolicy(MemberCachePolicy.ALL)
.build();
// get all users in total:
long totalUsers = jda.getUserCache().size();
// get from a specific server
long guildUsers = jda.getGuildById(1234567890L).getMemberCount();Also, follow the issue template next time please :) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Insert Link
Loading
Loading
Translated from {{ originalLanguageInEnglish }}
Beta Was this translation helpful? Give Feedback
Beta 이 번역이 도움이 되셨나요? 피드백 제공
Beta Esta tradução foi útil? Dê sua opinião
Beta ¿Fue útil esta traducción? Envía tus comentarios
just think this may be a cool easy feature