Discord.js: Guild#fetchMembers never resolves.

Created on 28 Feb 2020  Â·  11Comments  Â·  Source: discordjs/discord.js

Please describe the problem you are having in as much detail as possible:
Calling .fetchMembers() never resolves. I looked at #1113 but this issue still seems to be present here.

Include a reproducible code sample here, if possible:


client.on("ready", async () => {
  console.log("Ready"); // To check that we have, in fact, logged in

  const guild = client.guilds.get("[guild id]"); // Get the guild
  await guild.fetchMembers(); // Call fetchMembers()
  console.log("Resolved"); // :( cri
});

Further details:

  • discord.js version: ^11.5.1
  • Node.js version: 13.2.0
  • Operating system: MacOS 10.13.6 (It's an old mac 😋)
  • Priority this issue should have – please be realistic and elaborate if possible: Medium-high priority. Many applications might use this feature.
  • [ ] I have also tested the issue on latest master, commit hash:
unverified caching gateway bug

All 11 comments

it can be related to recent discord intents stuff
they basically plan to not allow bots to access guild members at all and its in testing phase iirc

"At all" is not exact. They plan to remove that for bots that are in 100 guilds or more and are not "verified" to have access to fetching members.
Additionally, your statement says that they not allow you to access any GuildMember, but that's not true either

"At all" is not exact. They plan to remove that for bots that are in 100 guilds or more and are not "verified" to have access to fetching members.
Additionally, your statement says that they not allow you to access any GuildMember, but that's not true either

well, probably getting "verified" state will be only for huge trusted bots and smaller ones will not even have chance to get that
"at all" is pretty right because if someone is making public bot i dont think they would enable that to limit their bot to 100 servers
and accessing GuildMember will be probably available only via command messages and similar i guess?
(i did mean guild members itself, like fetching them or getting object from server members(like memberlist in client), not from things like messages)

well, probably getting "verified" state will be only for huge trusted bots and smaller ones will not even have chance to get that

The huge bots are already beyond 100 guilds, so that statement has no corelation to whether bot will be verified or not. Discord claims you need to have verified bot to have access after reaching 100 guilds, but does not say that your bot has to have 10000 guilds for verification being considered.

"at all" is pretty right because if someone is making public bot i dont think they would enable that to limit their bot to 100 servers

Well, what if someone is making bot for single guild? then they don't have limited access to fetching members.
Also, from definition of "at all", what you effectively said is that discord is testing api without guildmember objects, or that any access to any guildmember object is forbidden for bots.

and accessing GuildMember will be probably available only via command messages and similar i guess?

I don't remember specifics out of my head now, but it should be in this pull request to discord-api-docs

well, probably getting "verified" state will be only for huge trusted bots and smaller ones will not even have chance to get that

@Roki100 they've said that they'll whitelist any bot that applies and demonstrates that it uses the functionality

From what I've gathered, this should be marked as a wontfix? Such a shame :(

the devs haven't responded, but it seems to work for me on v12 (guild.members.fetch())

This is still working fine for me on 11.6.1.

  1. Make sure you did not mess with disabledEvents of ClientOptions to avoid discarding required incoming events.
  2. Make sure you did not mess with an undocumented use of intents, as that will break this method too.
  3. (Obviously make sure there are no other modification on the library or cache or whatever.)

If it still does not work attach a handler to raw and see if the expected GUILD_MEMBERS_CHUNK events are actually coming in:

client.on('raw', packet => {
  if (packet.t === 'GUILD_MEMBERS_CHUNK') {
    console.log(packet.t, packet.d.guild_id, packet.d.members.length);
  }
});

If they do, there likely is something wrong on our end, not sure how much could be done about that though.
If none are coming, something else is wrong, either 2. or Discord.


re: Intents

Just to clarify that:
Unless you specify intents, the behavior of the gateway is the same as before, WITHOUT a 100 guilds limit of any form.
(At least that's what Discord promised us.)
Until gateway v7 drops, where intents are becoming mandatory.

Also applying for privileged intents is supposedly going to be somewhat reasonable and not restricted to just huge and "trusted" bots.
(How that actually works out is a different matter though.)

I have not disabled anything. I ran

yarn init -y
yarn add discord.js

and copy pasta'd the code I sent above (along with the requirements and .login, of course.

Going to close as we no longer support or fix version 11, feel free to re-open or link to this in a new issue if you can reproduce it on the current stable version (12.3.1 as of writing this).

Sounds good. v12 is working for me fine. Thanks :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lombra picture Lombra  Â·  3Comments

smchase picture smchase  Â·  3Comments

Brawaru picture Brawaru  Â·  3Comments

DatMayo picture DatMayo  Â·  3Comments

tiritto picture tiritto  Â·  3Comments