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

220
Views
How do I send a DM to a user in discord.js v13

All I'm doing right now is trying to send a dm to myself to see if I can get this working. I've tried:

client.users.cache.get(id).send('hi')
But I'm getting "TypeError: Cannot read properties of undefined (reading 'send')." I suppose this has something to do with myself not being cached, but I'm unsure how to go about caching myself. Does anyone know how to properly do this?

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

0

Please take look at this post, it could resolve your problem.

Basically what it seems to happen is that the get method isn’t consistent like fetch. So prefer to use the fetch method, it will look something like this:

const user = await client.users.cache.fetch(id)
user.send('hi')

if you’re not in a asynchronous scope you could use the "then" approach:

client.users.cache.fetch(id)
  .then((user) => user.send('hi'))
  .catch(e => console.log(e))
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!