Create and overwrite channel permissions with Discord.js

14,111

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);
Share:
14,111

Related videos on Youtube

Trax
Author by

Trax

Updated on June 04, 2022

Comments

  • Trax
    Trax about 2 years

    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);
    
    • Kaynnc
      Kaynnc almost 7 years
      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?