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.members.fetch() not responds #38

Closed
aSashaaa opened this issue Apr 16, 2022 · 6 comments
Closed

guild.members.fetch() not responds #38

aSashaaa opened this issue Apr 16, 2022 · 6 comments
Labels
bug Something isn't working Fixed ok it's working

Comments

@aSashaaa
Copy link

aSashaaa commented Apr 16, 2022

invite = await client.fetchInvite(inviteCode);
guild = await client.guilds.fetch(invite.guild.id);

guild.members.fetch().then(members => console.log(members));

I could manage to fetch the guild object, but the members part keeps failing.

edit: After a long time it threw an error Error [GUILD_MEMBERS_TIMEOUT]: Members didn't arrive in time.

@aiko-chan-ai
Copy link
Owner

aiko-chan-ai commented Apr 16, 2022

invite = await client.fetchInvite(inviteCode);
guild = await client.guilds.fetch(invite.guild.id);

guild.members.fetch().then(console.log);

I could manage to fetch the guild object, but the members part keeps failing.

if you are not having the rights to manage roles, or manage users, it means opcode 8 is not working
With opcode 14 you can get a certain number of members but won't be able to get by promise in members.fetch() [bug :)]
So after you fetch() you can use guild.members.cache

@aSashaaa
Copy link
Author

Sooo can you send me a code which actually works? :D

@aiko-chan-ai
Copy link
Owner

Sooo can you send me a code which actually works? :D

const sleep = (sec) => new Promise((r) => setTimeout(r, sec * 1000)); // delay function
await guild.members.fetch()
sleep(2) // I think 2 seconds is enough for a 1000 member server
const members = guild.members.cache

@aSashaaa
Copy link
Author

still not works.

the code stucks on await guild.members.fetch().

@aiko-chan-ai
Copy link
Owner

const sleep = (sec) => new Promise((r) => setTimeout(r, sec * 1000));

I'm working on a fix, you can wait for the next version

@aiko-chan-ai aiko-chan-ai added the bug Something isn't working label Apr 17, 2022
@aiko-chan-ai
Copy link
Owner

bug fixed, please update to version 1.3.9

@aiko-chan-ai aiko-chan-ai added the Fixed ok it's working label Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed ok it's working
Projects
None yet
Development

No branches or pull requests

2 participants