Felix Platzer
Felix Platzer

Reputation: 33

How to create a role in discordjs with permissions?

How to create a role in discordjs with permissions? i have found this code somewhere and i cant find how to create a role with permissions.

message.guild.roles.create({ // Creating the role since it doesn't exist.
   data: {
       name: "#Red",
       color: "#ff0000",
       permissions: 0
   }
}).then(role => {
   message.channel.send(`Role \`${role.name}\` created!`);
});```

Upvotes: 0

Views: 2017

Answers (1)

Nothingness
Nothingness

Reputation: 93

You can use

message.guild.roles.create({ // Creating the role since it doesn't exist.
   data: {
       name: "#Red",
       color: "#ff0000",
       permissions: ["ADMINISTRATOR"] //Use , for more. Ex ["KICK_MEMBERS", "BAN_MEMBERS"]
   }
}).then(role => {
   message.channel.send(`Role \`${role.name}\` created!`);
});

Docs

Upvotes: 2

Related Questions