【问题标题】:How do I change role settings in discord.js? [duplicate]如何更改 discord.js 中的角色设置? [复制]
【发布时间】:2021-02-14 20:46:29
【问题描述】:

好的,我不是说权限,我是说:https://i.stack.imgur.com/Y5wWl.png 我想用它来制作服务器模板。

谢谢,再见!

【问题讨论】:

    标签: node.js discord discord.js


    【解决方案1】:

    您要查找的内容称为hoist。您可以通过在角色上使用.setHoist() 方法来更改是否提升角色。假设您在消息事件中,您可以在其中执行以下操作来提升特定角色:

    bot.on('message', message => {
        const yourRole = message.guild.roles.cache.find(r => r.name === 'role-name'); // get the role using it's name, you can also find it using the id if you want to.
        yourRole.setHoist(true);  // setting hoist to true for this role
    }
    

    就是这样。这将使拥有此特定yourRole 的成员出现在不同的类别下。

    您还可以在使用<RoleManager>.create() 方法创建角色时指定是否提升角色。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-23
      • 2020-12-28
      • 1970-01-01
      • 2021-01-24
      • 2021-07-01
      • 2021-05-21
      • 1970-01-01
      • 2021-05-03
      相关资源
      最近更新 更多