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

94
Views
Blacklist user IDs discord.js

How do I make my bot ignore users that I've added to a list? I'm new to this. I tried a few other ways I found on this site but I don't know how to add them to my code, I tried and failed.

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

0

Try this:

let blacklistUser = ['UserID1','UserID2']

if(!blacklistUser.includes(user.id)){
    ///your code
}

Here is a short explanation of the code:

let blacklistUser = ['UserID1','UserID2'] This is an array with the IDs of the blacklisted Users

if(!blacklistUser.includes(user.id)){}

The ! means "NOT" and blacklistUser.includes(user.id) is a funcion that checks if an array(blacklistUser) includes an object(user.id)

You should replace user.id with the needed variable. For example in a message event it would be: message.author.id.

I hope I could help you, to fix this problem.

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!