discord rest api how to send dm ?

Hello, I am using discord-api-types and discordjs/rest for my worker based discord bot. According to docs,
rest.post(Routes.channelMessages(env.LOGS_CHANNEL_ID), ...));
rest.post(Routes.channelMessages(env.LOGS_CHANNEL_ID), ...));
is for sending messages to any discord server's channel. But I want to send message to a user's DM, how do I do that?
9 Replies
d.js toolkit
d.js toolkit4w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Kinect3000
Kinect30004w ago
Use the dm channel id There is an endpoint for opening user dms
Ren Hiyama
Ren HiyamaOP4w ago
No description
Ren Hiyama
Ren HiyamaOP4w ago
Routes.<what??>
d.js docs
d.js docs4w ago
:discord: Users Resource - Create DM POST /users/@me/channels Create a new DM channel with a user. Returns a DM channel object (if one already exists, it will be returned instead). read more
Kinect3000
Kinect30004w ago
Idk what it’s called in the dapi-types package
Ren Hiyama
Ren HiyamaOP4w ago
I found this
No description
Kinect3000
Kinect30004w ago
Yea Use that with the proper body to get a dm channel
Ren Hiyama
Ren HiyamaOP4w ago
ah ok, thanks.
Want results from more Discord servers?
Add your server