Lost Bot Member due to Cache Options?

Bit of a biggie, I had an error: TypeError: Cannot read properties of null (reading 'bitfield') In this code:
channelToMessage.permissionsFor(
client.guilds.cache.get(guildId).members.me
).bitfield
channelToMessage.permissionsFor(
client.guilds.cache.get(guildId).members.me
).bitfield
I think it's because I changed my caching to:
makeCache: Options.cacheWithLimits({
MessageManager: 5,
GuildMemberManager: 5,
PresenceManager: 5,
}),
makeCache: Options.cacheWithLimits({
MessageManager: 5,
GuildMemberManager: 5,
PresenceManager: 5,
}),
I suspect this lost me the bot Member in the cache...? and thus members.me So I've updated to:
makeCache: Options.cacheWithLimits({
MessageManager: 5,
GuildMemberManager: {
maxSize: 5,
keepOverLimit: ({ id }) => id === CLIENT_ID
},
PresenceManager: 5,
}),
makeCache: Options.cacheWithLimits({
MessageManager: 5,
GuildMemberManager: {
maxSize: 5,
keepOverLimit: ({ id }) => id === CLIENT_ID
},
PresenceManager: 5,
}),
Does this all checkout to anyone, I have applied this change but am curious if this could have happened in the firdt place. If not, whst caused the error? 🤔
6 Replies
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yinoguns
YinogunsOP•2y ago
Node v16.19.0
Unknown User
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yinoguns
YinogunsOP•2y ago
That's a good question, what does <Channel>.permissionsFor(null/undefined) return 🤔 I guess it would return null also...
MrMythical
MrMythical•2y ago
Yes, it would return null if something that is not a RoleResolvable/UserResolvable is not passed
Yinoguns
YinogunsOP•2y ago
Yup, I yeeted the bot then, woops
Want results from more Discord servers?
Add your server