javascript - Editing discord role permissions. (discord.js) - Stack Overflow

I am trying to write a mand that will let a user create a role. So far I've gotten this:if (msg.co

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
Add a ment  | 

1 Answer 1

Reset to default 2

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745265695a4619440.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信