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

Get Guild Members #6

Closed
andy-t-wang opened this issue Mar 28, 2022 · 3 comments
Closed

Get Guild Members #6

andy-t-wang opened this issue Mar 28, 2022 · 3 comments

Comments

@andy-t-wang
Copy link

Is there a way to get guild members using a user account?
This works for a regular bot but does not return anything when using a user account.

guild.members.fetch().then( (members) => members.forEach((member) => console.log(member.user.username)), (message) => console.log(message) )

@aiko-chan-ai
Copy link
Owner

when i run it found out all GuildMembers are cached, Promise doesn't return results
so if you want to use this here is your code

message.guild.members.fetch().then(() => message.guild.members.cache.forEach((member) => console.log(member.user.username)))

sorry for your experience

@azurenekowo
Copy link

@andy-t-wang fetch() are not supported by userbot, therefore you have to use cached.

@aiko-chan-ai
Copy link
Owner

aiko-chan-ai commented Mar 29, 2022

@andy-t-wang fetch() are not supported by userbot, therefore you have to use cached.

if you look here the answer is correct
but when using websocket it is still possible to fetch()

      this.guild.shard.send({
        op: Opcodes.REQUEST_GUILD_MEMBERS,
        d: {
          guild_id: this.guild.id,
          presences,
          user_ids,
          query,
          nonce,
          limit,
        },
      });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants