Members didn't arrived in time.

why do I get this error sometimes when I try to fetch selective members?
49 Replies
d.js docs
d.js docs3y ago
• 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.
Ashu
AshuOP3y ago
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Ashu
AshuOP3y ago
Yes I do have it. It just happens I try to fetch selective members
monbrey
monbrey3y ago
If its attempting to fetch say, 20 IDs And they arent all in the server It times out waiting for the rest I think
Ashu
AshuOP3y ago
hmm so how would I implement this without fetching every single member?
souji
souji3y ago
a) not b) specifying some timeout you want to wait for and assuming there were none if it doesn't return anything
Ashu
AshuOP3y ago
hmm is there a way I can just make it ignore all the members that didn't came on time and just get all the other ones? or does this error occur when no members are found?
souji
souji3y ago
well, if there are results they will arrive
Ashu
AshuOP3y ago
oh so that means this error means no members were found on the guild right?
souji
souji3y ago
the issue with it is the arbitrary timeframe, "wait for <some magic number> and assume" is not a workflow i like, personally not necessarily
Ashu
AshuOP3y ago
oh
souji
souji3y ago
could also be that the connection was bad or that you just didn't wait long enough the error means what it says, really
Ashu
AshuOP3y ago
ya get it ig I just have to fetch all of them
souji
souji3y ago
you made a request to get member payloads, but they didn't arrive after the (specified) timeout duration
Ashu
AshuOP3y ago
ya got it Thanks :)
souji
souji3y ago
so yeah, i personally prefer to just fetch all and live with that interface being absolutely unusable firL
Ashu
AshuOP3y ago
;__; lol
souji
souji3y ago
do keep in mind, though, that fetching all doesn't scale all that well as they arrive in chunks for an 800k server i wait betewen 15 and 30 seconds just so members arrive
Ashu
AshuOP3y ago
ya that's why I wanted to fetch only the required ones
souji
souji3y ago
what's the ballpark for the req. ones we're talking about? if it's not a whole lot iterating and fetching them via rest as single members might even be a better approach
Ashu
AshuOP3y ago
nope...there could be any amount from 1-50 members and 50 becomes bad when fetching each one could be more members but thats the average
souji
souji3y ago
does it?
Ashu
AshuOP3y ago
ya I have tried it was taking like a whole min to do stuff sometimes
souji
souji3y ago
firT i think i've def. fetched members at that scale before without much issues the user endpoint is rather heavily limited, but single members?
Ashu
AshuOP3y ago
huhhhhhh right actually....I have fetched users when I was fetching them individually and haven't used each member fetch hmmmm
souji
souji3y ago
yeah, fetching users is horrendous because that can be global users but members that have to be on the server are usually fine
Ashu
AshuOP3y ago
could be that ig I will implement that and test nice
souji
souji3y ago
i mean, should prob. not do it at like.. thousands at some point fetching all is def. preferable
Ashu
AshuOP3y ago
if it works I will set a limit like for < 50-100 fetch each members and after that fetch mass and use those. ya
souji
souji3y ago
and if your server(s) are generally much smaller fetching all won't take any time at all like.. -ev msg.guild.members.fetch().then(m => m.size)
yuzu
yuzu3y ago
64111
64111
• d.js 14.0.1 • Type: number • time taken: 2536.633259ms
Ashu
AshuOP3y ago
oh ya I could also check the member count as well
souji
souji3y ago
that aint that bad, 2.5s for 60k
Ashu
AshuOP3y ago
right so I could account for amount of member trying to fetch and the size of the guild that should work
souji
souji3y ago
or you can just fetch all and make sure you defer and maybe inform the user that something is happening looking at "bot is thinking" for 30s sure isn't the best UX
Ashu
AshuOP3y ago
ya lol but will there be any rate-limits? like come times a new feature comes and all server just run tons of shit lol
souji
souji3y ago
becomes even more fun if you bulk-ban thousands of members, which might take north of 15minutes so the slash webhook expires firL
Ashu
AshuOP3y ago
like ik there will be but I just don't wanna spam the hell out of the api lol ya happened to me before lol
souji
souji3y ago
firShrug who knows what discord will do doubt they even know themselves
Ashu
AshuOP3y ago
interaction.webhook.editMessage(interaction.message, {...newStuff});
interaction.webhook.editMessage(interaction.message, {...newStuff});
shy
souji
souji3y ago
only for 15 minutes
Ashu
AshuOP3y ago
no like this works beyond that
souji
souji3y ago
can't, because the webhook token expires after 15
Ashu
AshuOP3y ago
oh hmm dahell that's weird cause issues were fixed after I did this....? what will be the better way to edit the message after 15 mins?
souji
souji3y ago
afaik you need the message instance with fetchReply set and then call edit on that without the whole webhook shenanigans
Ashu
AshuOP3y ago
oh so like re-fetch every 15 mins? or just a single re-fetch will be forever?
souji
souji3y ago
afaik #editReply doesn't do anything different than that, and that def. failed after 15 minutes i will, however check that out again that's simplify things quite tremendously because atm that means i do need view perms for the bot in the channel the command is ran in, which wouldn't be the case if i oculd use the wh single fetch, but use the endpoint to edit the regular channel message, not with the webhook endpoint
Ashu
AshuOP3y ago
right oh got it i will test this too
Want results from more Discord servers?
Add your server