【问题标题】:Create and overwrite channel permissions with Discord.js使用 Discord.js 创建和覆盖频道权限
【发布时间】:2018-03-04 05:08:26
【问题描述】:

我正在尝试创建一个新频道并覆盖@everyone 的权限,以便只有选定的角色可以访问该频道。无论我尝试什么,似乎频道权限都保持不变。最近 2 次尝试:

    Guild.createChannel(permName, 'text',[{
     type: 'role',
     id:359999680677019649,
     deny:0x400
    }])
    .then(channel => console.log(`Created new channel ${channel}`))
    .catch(console.error);

/////////

    Guild.createChannel(permName, 'text',[{
     type: 'role',
     id:359999680677019649,
     permissions:1024
    }])
    .then(channel => console.log(`Created new channel ${channel}`))
    .catch(console.error);

【问题讨论】:

  • 您的意思是希望机器人创建一个只有具有角色的人才能看到的频道?而没有角色的人看不到频道?

标签: javascript discord discord.js


【解决方案1】:

ID 字段必须是字符串。

    Guild.createChannel(permName, 'text',[{
     type: 'role',
     id:'359999680677019649',
     deny:0x400
    }])
    .then(channel => console.log(`Created new channel ${channel}`))
    .catch(console.error);

【讨论】:

    猜你喜欢
    • 2021-02-01
    • 2019-10-21
    • 2021-09-19
    • 2021-08-05
    • 2022-01-18
    • 2021-03-16
    • 2023-03-27
    • 2020-05-07
    • 1970-01-01
    相关资源
    最近更新 更多