Error with guild.members.me
Our bot is divided into several shards and clusters. To be able to make some updates, we go through each cluster and then each guild with client.guilds.cache.values(). But then guild.members.me is often null. However, the bot is still on the server. What could be the reason for this?
7 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!it should only be null if you're removing it from cache somehow, such as with a sweeper
we do not clear the cache at any point.
where and how would I do something like this?
that's the current client constructor.
- these are the intents
- the rest is not mine, could that cause problems?
here comes the log that member was not found
with this code I call the hasNeededDiscordPermissions
guild comes from client.guilds.cache.values()
yes that will be checked
Because of an NDA I am not allowed to send it in a public chat. can we continue writing via dm?
that the code from the beginning to the error
this is just to limit the execution to prevent ratelimits 😄
its not using it
just the name of it to be able to handle all cases
Tbh no I didnt knew, how is that done ?
Just fetch ratelimits or also update and send ratelimits ?
Well we built that to prevent channel rename rate limits from happening
Which actually happened quite alot, so either we are not using it correctly or its not working for some reason in our project
So your plan on fixing with the "guild.members.me" would be just to check and skip it ?
Or refetch the cache everytime before ?
I dont trust our code, so there must be something we do wrong 😆
Yes we do fetch them before, it is passed via the "guild" parameter
ohh, we do that everywhere 🤦♂️
so better client.guilds.cache.get ?
Well, that could explain some errors we encounter currently.... 😆
Check
Thank you ❤️
oh i don't need to do
client.user.setActivity
on ready in v14?
interesting
v13 didn't have this iircalright