I am trying to write a mand 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.
I am trying to write a mand 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.
Share Improve this question edited Jul 22, 2018 at 11:10 Blundering Philosopher 6,8152 gold badges45 silver badges61 bronze badges asked Jul 21, 2018 at 19:11 anonymousanonymous 691 gold badge2 silver badges9 bronze badges 1- 1 And the question is? – André Commented Jul 22, 2018 at 8:26
1 Answer
Reset to default 2Assuming 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
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745265695a4619440.html
评论列表(0条)