Differences between UserManager cache and GuildMemberManager cache

What's the difference between the UserManager cache and the GuildMemberManager cache? I understand the difference between a user and a GuildMember, but if the user cache is disabled does that mean guildMember.user wouldn't exist? or would it simply stop things like client.users? Ping on reply Additionally, cache only applies when you access things in the cache right? for instance, if a interaction request comes in and I have the UserManager cache disabled, I can still do intr.user. or intr.client.user correct?
4 Replies
d.js toolkit
d.js toolkit2y 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.
Stqlth
StqlthOP2y ago
Is there a way to disable the user cache but not the client user? okay gotcha
Stqlth
StqlthOP2y ago
would it disable this getUser()?
Stqlth
StqlthOP2y ago
since its getting it from the interaction options guess I could test it real quick perfect, looks like I should be able to disable the UserManager cache, should save a decent bit of memory thanks! that's true, just been looking into what I can disable as memory usage is getting quite high I've limited messages, my Bot is Birthday Bot which uses the GuildMember cache quite a bit but not the user cache, only ever time it uses the user is when it accesses it from the GuildMember Ah, the GuildMember references the user cache, that is good to know, yea then I shouldn't be disabling it What is the use case for the ApplicationCommandManager cache? Is it for viewing other application's commands? Alright. Last question (probably 😂) Does the GuildMember cache clean up old members? For instance, if I guild.members.fetch() will it replace the entire guild's member cache or simply update existing and add new entries? If it doesn't remove old, I am guessing that is what the sweeper is for That's very good to know, thank you I am pretty sure there is a way but how do you make the bot fill a cache at start up, for instance, if I rely on the GuildMember cache I want the bot to guild.members.fetch() on start up Found an answer to my question here: https://discord.com/channels/222078108977594368/987758148733509683/987767701231530106 I probably don't want to fetch all on startup I currently have a job that runs periodically to update the GuildMember cache, I suppose I will just change it to only happen once
Want results from more Discord servers?
Add your server