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

823 Views Asked by At

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?

1

There are 1 best solutions below

0
MrMythical On BEST ANSWER

Use UserManager#send(). This will create a dm if needed, then send the message

client.users.send(userId, "content")