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

167
Views
How do I fix discord.js ban command?

I can't understand what is wrong in this code. Error: Cannot read property 'users' of undefined

module.exports = {
name: "ban",
execute(client, message, args) {
    const author = message.member
    const target = message.mentions.users.first()
    const reason = args.slice(1).join(' ')
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

It is actually message.mentions.members.first()

which will then take the first member mentioned in the message

about 4 years ago · Juan Pablo Isaza Report

0

This means that message is not a real Message object. Make sure in your command handler, the arguments are passed like this:

(client, message, args)

In that order. I suspect it might be something like this right now

(message, client, args)
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!