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

203
Views
Get a user by username?

I would like to get a user by the username. I know how that works:

let user = client.users.find(user => user.username == "TESTname");

But what if there are 2 users who have the same username?

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

although getting a user with username instead of with id is a terrible idea, here is how you can do it with V13 :

const users = client.users.cache.filter(user => user.username == "TESTname");

consider it is preferable to have the ID of the user, so you can fetch it directly from Discord:

client.users.fetch("304541381798658048").then(user => {
console.log(user)
})
about 4 years ago · Santiago Gelvez 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!