I am trying to write a command that will let a user create a role. So far I've gotten this:
if (msg.content == '-create')
{
msg.guild.createRole({name:"new role", color: "00FFFF", mentionable: false});
}
I am trying to have it so it gives the role the admin perm. This is of course assuming that the bot also has admin perm.
Assuming that you want to create a role with an admin perm, I suggest you consult the discord.js docs .
When you go to create a role, a RoleData object is required. You already have that, but you will need to add in an array with the permissions you want with the key permissions
.
In that array all the permissions for the role must be listed. A list of all the permission flags is here .
So, for example if I wanted to create a role with the ability to mention everyone (assuming people are not given that permission by default), I would use: <Message>.guild.createRole( {name:"Mentioners", color: "#ff0000", permissions:["MENTION_EVERYONE"] } );
I hope this helped you with your problem!
- Trifex
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.