Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guild#fetchMembers never resolves. #3848

Closed
1 task
alii opened this issue Feb 28, 2020 · 11 comments
Closed
1 task

Guild#fetchMembers never resolves. #3848

alii opened this issue Feb 28, 2020 · 11 comments

Comments

@alii
Copy link

alii commented Feb 28, 2020

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:
@Roki100
Copy link
Contributor

Roki100 commented Feb 28, 2020

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

@tipakA
Copy link
Contributor

tipakA commented Feb 28, 2020

"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

@Roki100
Copy link
Contributor

Roki100 commented Feb 28, 2020

"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)

@tipakA
Copy link
Contributor

tipakA commented Feb 28, 2020

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

@advaith1
Copy link
Contributor

advaith1 commented Mar 1, 2020

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

@alii
Copy link
Author

alii commented Mar 2, 2020

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

@advaith1
Copy link
Contributor

advaith1 commented Mar 2, 2020

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

@SpaceEEC
Copy link
Member

SpaceEEC commented Mar 2, 2020

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.)

@alii
Copy link
Author

alii commented Mar 2, 2020

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.

@almostSouji
Copy link
Member

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).

@alii
Copy link
Author

alii commented Aug 22, 2020

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

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants