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

333
Views
Adding permissions for roles on discord js

Hey all found this script for users posting invite links... Let's say I wanted to whitelist certain channels from not allowing the bot to ban or kick users posting invite links. Hopefully that makes sense. Thanks.

adminClient.on("message", async message => {
  if (!message.member) return;
  const linkRegex = /(https?:\/\/)?(www\.)?(discord\.(gg|io|me|li|com)(\/invite)?)\/.+[a-z0-9A-Z]/
  if (message.content.startsWith("?ban") && message.member.hasPermission("ADMINISTRATOR")) {
    const mentionedMember = message.mentions.members.first();
    if (!mentionedMember) return message.channel.send("You must mention who you want to ban.")
    mentionedMember.ban().catch(e => message.channel.send(`Something went wrong when banning that user.\n\`${e}\``))
  } else if (message.content.startsWith("?kick") && message.member.hasPermission("ADMINISTRATOR")) {
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You just need to know the channel ID of the channel that u want to whitelist and add a condition on top of that, this way:

if (message.channel.id==WHITELIST_CHANNEL_ID) return;
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!