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
Discord.js || Can bot track ban list?

There are a lot of to ban a user in a server, you can do it manually or with another bot. I want my bot to scan a banlist, and if someone will get banned, it will send a message "user (id) has been banned

I started writing smt but now, I had no idea what can I do to check it. EDIT: It's working now, but it still need to find this user id.

client.on('guildBanAdd', message => {
  client.user.cache.find() //idk how to define it
  const channel1 = client.channels.cache.find(channel => channel.id === "158751278127895");
  channel1.send('12512');
  
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You don't have to fetch bans because the guildBanAdd event parses a GuildBan object,
which als includes a User object.

client.on('guildBanAdd', ban => {
    console.log(ban.user.username); // Username
})
  • message.channel won't work because there isn't a message object.

If you want to get the executor (moderator) who performed the ban, kick etc.
There is a good guide for this Working with Audit Logs

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!