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

227
Views
Change channel permissions in discord.js

I tried to make a simple channel lock function in DiscordJS but I ran into a problem while trying to do so.

The problem is probably in message.channel.overwritePermissions

Here is the error

if (message.member.hasPermission("MUTE_MEMBERS")) {
  let roles = message.guild.roles;
  let allRole = roles.cache.find(r => r.id === '902820481110011934');
  message.channel.overwritePermissions({
    SEND_MESSAGES: true
  });
} else {
  message.channel.send("You don't have permission to do this!");
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

GuildChannel.overwritePermissions accepts only an array or collection of OverwriteResolvable. OverwriteResolvable can be OverwriteData. The id is required. This is the way to set overwrites in v12

message.channel.overwritePermissions({
  id: "role_or_user_id",
  allow: ["SEND_MESSAGES"]
})
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!