get member role cache crash

TypeError: Cannot read properties of undefined (reading 'id') at get cache [as cache] all I'm doing is accessing the member role cache, and it crashes, because there's no @everyone role? to get an id from? attached is screenshot of src/managers/GuildMemberRoleManager.js:37:101) at the error
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.
chmod
chmodOP2y ago
no
duck
duck2y ago
are you customizing or otherwise modifying the cache in any way? care to share your client constructor? I can't imagine you don't have the Guilds intent if you have access to a GuildMember object, but could you ensure that you do anyways?
chmod
chmodOP2y ago
yup just solved it
const guildRoles = guild.roles.cache;
guildRoles.delete(guild.roles.everyone?.id);
const guildRoles = guild.roles.cache;
guildRoles.delete(guild.roles.everyone?.id);
Forgot to .clone()
const guildRoles = guild.roles.cache.clone();
const guildRoles = guild.roles.cache.clone();
you were 100% correct
Want results from more Discord servers?
Add your server