最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论