admin管理员组

文章数量:1327135

I'm trying to create a new channel and overwrite the permissions of @everyone so that only a selected role has access to the channel. No matter what I try it seems that the channel permissions remain unchanged. Last 2 attempts :

    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);

I'm trying to create a new channel and overwrite the permissions of @everyone so that only a selected role has access to the channel. No matter what I try it seems that the channel permissions remain unchanged. Last 2 attempts :

    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);
Share Improve this question edited Mar 27, 2018 at 13:25 p-a-o-l-o 10.1k2 gold badges24 silver badges36 bronze badges asked Sep 22, 2017 at 15:02 TraxTrax 1,5587 gold badges22 silver badges43 bronze badges 1
  • Did you mean that you want the bot to create a channel, which only people with roles can see it? And those without roles cannot see the channel? – WQYeo Commented Sep 22, 2017 at 15:47
Add a ment  | 

1 Answer 1

Reset to default 4

The ID field had to be a string.

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

本文标签: javascriptCreate and overwrite channel permissions with DiscordjsStack Overflow