How to add a role to a user in a specific guild

So I have this current code:

const mutualGuilds = bot.guilds.cache.filter((guild) => {
  return guild.members.cache.has(;

if (mutualGuilds.roles.cache.has("guildid")) {
  if (mutualGuilds.users.cache.has( {
    let userInGuild = mutualGuilds.users.cache.find("roleid");

And when I try the command it outputs: Cannot read property 'cache' of undefined

If someone could help that would be amazing since my bot is on release today.

Leave a Comment