Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
Create discord channel with specific roles js
let myRole = message.guild.roles.cache.find(role => role.name === "Admin");
message.guild.channels.create(
  channelName2, 
  {
    type: "GUILD_TEXT",
    permissionOverwrites: [
      {
        id: myRole.id,
        allow: ["SEND_MESSAGES", "VIEW_CHANNEL", "READ_MESSAGE_HISTORY"],
      },
      {
        id: myRole.id,
        deny: ["VIEW_CHANNEL"]
      }
    ]
  }

Bot creates the text channel but has no permissions edited and it ignored almost whatever I write in "id: XXXXXX"

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem is the way you are editing the permissions,

First you edit it to allow

    {
        id: myRole.id,
        allow: ["SEND_MESSAGES", "VIEW_CHANNEL", "READ_MESSAGE_HISTORY"],
      }

Then you edit to deny permissions

      {
        id: myRole.id,
        deny: ["VIEW_CHANNEL"]
      }

However by doing it twice you undo the permissions of the first time, the correct way to do it would be by making it into one object:

message.guild.channels.create(
  channelName2, 
  {
    type: "GUILD_TEXT",
    permissionOverwrites: [
      {
        id: myRole.id,
        allow: ["SEND_MESSAGES", "VIEW_CHANNEL", "READ_MESSAGE_HISTORY"],
        deny: ["VIEW_CHANNEL"]
      }
    ]
  }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!