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

122
Views
Cannot read properties of undefined (reading 'bannable')
    message.mentions.members.forEach(men => {
      let member = message.mentions.members.get(men)

      if (!member.bannable) return message.reply(not_bannable)
    
      const reason = args.slice(1).join(" ");
      member.ban({reason: reason || "no reason"}).then((member) => {
        message.channel.send(member + " banned by " + message.author.id)
      }).catch(err => console.log(err))
  })

I'm trying to build a ban command that allows you to ban multiple users at once. Unfortunately, an error occurs when I execute it.

I work with discord v13

Why does this error occur?

Cannot read properties of undefined (reading 'bannable')
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use men since it's already a GuildMember object

message.mentions.members.forEach(men => {

      if (!men.bannable) return message.reply(not_bannable)
    
      const reason = args.slice(1).join(" ");
      men.ban({reason: reason || "no reason"}).then((member) => {
        message.channel.send(member + " banned by " + message.author.id)
      }).catch(err => console.log(err))
  })
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!