DM mentioned user and in a channel

How do I make my bot send a message to the user mentioned in the DM and a certain channel?

If you are using discord.js, try this:

const user = [CLIENT].users.cache.get('[USERID]');

i mention a user in the cmd. would that pop up in the message?

Mentioning a user in the terminal would not popup a message in a DM.

i don’t get the code part. can you restate that more clear please.

Ok so let me break this code down.

const user = client.users.cache.get('[USERID')

This will get the user ID of the person you want to DM and


will send the message to that person.

no. i wan’t a message send to the user i mentioned in the command.

First get the person you mention using message.mentions.users.first(). Then send the message to the user returned.


let user = message.mentions.users.first();
user.send('whatever your message is');