How could I make it send a DM to me?

Hey, using this code:

"const Discord = require(‘discord.js’)

var prefix = process.env.PREFIX = async(client, message, args) => {
const reporteduser = message.mentions.members.first();
let reason = args[1]
let time = args[2];
const report = new Discord.RichEmbed()
.setTitle(‘New Blacklist!’)
.setDescription(‘Blacklist Info:’)
.addField(‘User blacklisted: ’ + reporteduser)
.addField(‘Reason:’ + reason)
.addField(‘Time:’ + time)
.setFooter(Reported by ${}!)
client.channels.get(‘712656551852376205’).send({ embed: report }).then(async embedMessage => {
message.delete();‘:white_check_mark: Blacklist Log has been sent!’)
client.channels.get(‘712644464585342986’).send( ’ just used the blacklist command!’)

} "

How can I make it so it would DM me the blacklist info?


That shows how to send a message in a channel, I still don’t get how to make it send a DM to me is a User

The User has a send method.

Meaning that you can use"message") to DM someone.


Tysm :heart:


You’re welcome :slight_smile:

1 Like

But what if someone else runs the command, is there any way I can make it still DM me?


‘client’ is how you defined your discord bot (sometimes it’s ‘bot’ or ‘app’)
‘someID’ is the ID of the user you want to send the message to.

How to find ID (click here)

To get your User ID or anyone else’s User ID right click on their name and click “Copy ID” To mention a user in a message right it in with <@id> It should look like this <@357240408373198868> and the numbers are the ID. Don’t think you need to do that in this case


Thanks <3


1 Like

@okboomer1234321 Does it work OK? Just checking cause I have never used it myself :slight_smile:

It does :slight_smile:


1 Like

Hey @EddiesTech,

Does this still work? Just checking since I am getting lots of errors.

This is the code I use:

  if (message.content.startsWith(prefix + "dm")){"Message");
1 Like

ty :slight_smile:

1 Like

It’s also worth mentioning that with the newest Discord.js version, members might not be cached at login, depending on your conigurations.