Iterating over all server members OR iterating over people with x role
Hello. Thank you for always being so helpful and taking care of us.
I'm having trouble iterating over but users and boosters. So my first approach was fetching all guild members, and iterating over that and checking if they are boosters, but fetching members times out.
So I tried this simple fetch of all the role members:
This somewhat works, it gets only 4 users though (there is 23 boosters). All of the 4 users it gets are boosters though. Both the console log and the message says 4 members.
Solution:Jump to solution
If fetching members times out it means you didn't give your bot the guild members intent
12 Replies
Giving it {force: true} does not make a difference
so basically you want to know which users of a server are boosters?
Yeah
I mean I dont have trouble with that otherwise where I know which user is in question and I can then check if they have that role
I could iterate over all the users but that'd be very slow
Try manually sending a fetch request using the endpoint the client also calls:
i.e. for this guild it is
https://discord.com/api/v9/guilds/737141877803057244/premium/subscriptions
@Vladdy might be able to tell you how auth works for the endpoint (it's an authorization header, I'm just not sure if it can be requested with a bot token, you can try though)
That endpoint is client only
oh <_<
You'll want to fetch all members first, then the role
Then you should get the right number
Solution
If fetching members times out it means you didn't give your bot the guild members intent
very lame discord, I thought I had a genius idea for once but oh no
That's not how you do bot auth anyways
Missing prefix
Interesting
Yep that's it, noob mistake as always
Happens to all of us