Skip to content Skip to sidebar Skip to footer

Discord.js Error Supplied Roles Is Not A Role, Snowflake Or Array Or Collection Of Roles Or Snowflakes

I'm making a mute command for my bot where it creates a muted role if there isn't one already and gives it to the user that is mentioned in the command, currently the error im gett

Solution 1:

You can use either async/await or .then, but i recommend using async/await. For example:


const mentionedMember = message.mentions.members.first() || await 
message.guild.members.fetch(args[0]);

const newMutedRole = await message.guild.roles.create({
        data: {
          name: 'Muted',
          color: '#ff0000',
          permissions: {
              SEND_MESSAGES: false,
              ADD_REACTIONS: false,
              SPEAK: false
          }
        },
        reason: 'to mute people',
      })


mendtionedMember.roles.add(newMutedRole)

Post a Comment for "Discord.js Error Supplied Roles Is Not A Role, Snowflake Or Array Or Collection Of Roles Or Snowflakes"