Discord.js: How can I PM a user?

Created on 25 Aug 2016  Â·  7Comments  Â·  Source: discordjs/discord.js

question (please use Discord instead)

Most helpful comment

You can use this :
msg.author.send("Content of message")

All 7 comments

sendMessage(channel, content, options, callback);

Where channel is user resolvable

Example Code:

client.on("serverNewMember", (server, user) => {
     client.sendMessage(user, "Welcome to: " + server.name);
});

client.on("message", (msg) => {
     client.sendMessage(msg.author, "I can see you sent a message in: " + msg.channel.name + ", but I am just a simple bot and haven't been programmed to do anything special with messages yet.");
});

What is user resolvable? How do I find out what it is?

On Wed, Aug 24, 2016 at 9:01 PM, bdistin [email protected] wrote:

sendMessage(channel, content, options, callback);

Where channel is user resolvable
http://discordjs.readthedocs.io/en/indev/docs_resolvables.html#user-resolvable

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/hydrabolt/discord.js/issues/537#issuecomment-242253287,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AT9RvZugY7r0U-c-j3RmKMHEceQZZySkks5qjOlcgaJpZM4JsmMj
.

Try clicking his link and scrolling down

You can use this :
msg.author.send("Content of message")

thats just to the sender of the message. he wants to send to a specific person. bdid you find an answer?

Please look at the date of the issue next time. Its over a year old.

Please look at the date of the issue next time. Its over a year old.

Who are you to tell anyone what to do "Big boi who likes to code and play games."

Was this page helpful?
0 / 5 - 0 ratings

Related issues

smchase picture smchase  Â·  3Comments

tom-barnes picture tom-barnes  Â·  3Comments

Dmitry221060 picture Dmitry221060  Â·  3Comments

iCrawl picture iCrawl  Â·  3Comments

shukriadams picture shukriadams  Â·  3Comments