Caching Problems
Hey, i have some problems with caching, on discord.js they sad
All Guilds are cached if you have the intent, and the client is ready
.
While using intents like GuildMembers
& Guilds
.
i dont know if it fits into this forum, i tough because sapphire initates the listeners....
sometimes when i do this here it doesnt show up some guild...
and when i restart the application it doesnt show up.
with this one i have no problems
7 Replies
or is maybe
tsc-watch
the cause?I think the problem is that you trying to filter by id in members.cache. User can be on the guild but didn't do anything so he isn't in cache. I think you need to loop trough all guilds and manually fetch member for each guild and then if member was found - add that guild as an option for your select menu
Second code works as needed because you just fetch all guilds and that's it. You don't rely on member cached in
members
property of guildmhm but i do much on server before adding option to selectmenu
ill try to test smth
I mean it's not like your bot need to do something, it's more about member need to be in guild's cache. You have 3 ways to do so:
1. Fetch all guild members
2. Fetch user by id
3. Let user do something that will put him in that cache. This is impossible for me because for 100% accuracy you will need to have user active on all guilds that he share with your bot :D
Ah yes second code doesnt filter forgot that
mean as a user
Wait, why do you have
!
when filtering guilds? .filter(x => !x.members.cache.get(message.author.id))
or is it intended? Maybe that was a casefilter undefined