#Need help to get members list

24 messages · Page 1 of 1 (latest)

lunar meteorBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

abstract matrix
#

Do you mean all members from all the guilds the bot is in? You will need to go through each guild your bot is in and fetch the members in that guild, I guess

abstract matrix
#

Then you can just get the guild by its id and fetch members

#

well the guy who answered you a few hours ago is probably right, the only logical answer that comes to my mind is that that you are not using the right guild id

#

well using client.guilds.fetch('id'), "id" must be the guild id

#

you can get it like this

#

ye

#

(let's keep it in english so that if some people in the future have the same issue, they can understand what we're talking about. also i guess not speaking english is breaking one of this server rules)
maybe console.log guild to make sure it is what it is supposed to be

main gazelle
#

The guild you are trying to fetch isn't acessible from your bot or your bot is missing the GuildMembers intent

#

Also do not fetch all the members on the bot start if your bot is in a lot of guilds, members.fetch is highly rate limited

proven eagle
#

or your bot is missing the GuildMembers intent
don't think that's correct for that particular error

proven eagle
#

sure, but fetching all members is a gateway thing

#

which is why if you do that and don't have the intent, d.js eventually throws a timeout

#

since nothing really arrives

main gazelle
#

Isn't related to the size of the fetch?

proven eagle
#

on which side

#

gateway side, rest api side, or d.js side

main gazelle
#

like if the size to fetch is greater than X, use the gateway, if not, use the normal fetch ?

proven eagle
#

cause d.js does completely different things depending on if you did fetch() or passed anything specific

main gazelle
proven eagle
#

and if you mean if the guild.members.fetch('id') could have given the error, no. even without the intent you are allowed to fetch single members, otherwise offline members would be physically unusable.

main gazelle
#

That's true

#

My bad