Private Message Bot Discord

245 views Asked by At

I want to add a feature to the bot, to contact a user in private with his id in parameter.

I already tried this:

sendMessage(idUser, "mesage")

but it doesn't work.

I have this error:

"sendMessage is not defined"

2

There are 2 answers

0
Trifex On

Try message.author.send("Your message here"); This takes the author of the sent message and sends a message to them.

Please note for the future, however, that sendMessage is depreciated in discord.js. Instead, just use send.

0
SovietSeal On

Yeah message.author.send("MESSAGE") should work

Also a little handy tip \n makes a new line if your making lines of text :D