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 docs2y 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
Ashu2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Ashu
Ashu2y ago
Yes I do have it. It just happens I try to fetch selective members
monbrey
monbrey2y 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
Ashu2y ago
hmm so how would I implement this without fetching every single member?
souji
souji2y ago
a) not b) specifying some timeout you want to wait for and assuming there were none if it doesn't return anything
Ashu
Ashu2y 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
souji2y ago
well, if there are results they will arrive
Ashu
Ashu2y ago
oh so that means this error means no members were found on the guild right?
souji
souji2y 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
Ashu2y ago
oh
souji
souji2y 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
Ashu2y ago
ya get it ig I just have to fetch all of them
souji
souji2y ago
you made a request to get member payloads, but they didn't arrive after the (specified) timeout duration
Ashu
Ashu2y ago
ya got it Thanks :)
souji
souji2y ago
so yeah, i personally prefer to just fetch all and live with that interface being absolutely unusable firL
Ashu
Ashu2y ago
;__; lol
souji
souji2y 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
Ashu2y ago
ya that's why I wanted to fetch only the required ones
souji
souji2y 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
Ashu2y 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
souji2y ago
does it?
Ashu
Ashu2y ago
ya I have tried it was taking like a whole min to do stuff sometimes
souji
souji2y 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
Ashu2y ago
huhhhhhh right actually....I have fetched users when I was fetching them individually and haven't used each member fetch hmmmm
souji
souji2y 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
Ashu2y ago
could be that ig I will implement that and test nice
souji
souji2y ago
i mean, should prob. not do it at like.. thousands at some point fetching all is def. preferable
Ashu
Ashu2y 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
souji2y 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
yuzu2y ago
64111
64111
• d.js 14.0.1 • Type: number • time taken: 2536.633259ms
Ashu
Ashu2y ago
oh ya I could also check the member count as well
souji
souji2y ago
that aint that bad, 2.5s for 60k
Ashu
Ashu2y ago
right so I could account for amount of member trying to fetch and the size of the guild that should work
souji
souji2y 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
Ashu2y 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
souji2y 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
Ashu2y 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
souji2y ago
firShrug who knows what discord will do doubt they even know themselves
Ashu
Ashu2y ago
interaction.webhook.editMessage(interaction.message, {...newStuff});
interaction.webhook.editMessage(interaction.message, {...newStuff});
shy
souji
souji2y ago
only for 15 minutes
Ashu
Ashu2y ago
no like this works beyond that
souji
souji2y ago
can't, because the webhook token expires after 15
Ashu
Ashu2y 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
souji2y ago
afaik you need the message instance with fetchReply set and then call edit on that without the whole webhook shenanigans
Ashu
Ashu2y ago
oh so like re-fetch every 15 mins? or just a single re-fetch will be forever?
souji
souji2y 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
Ashu2y ago
right oh got it i will test this too