Prism
Prism

Reputation: 53

Send a DM and then reacts to the message once a new user joins

so every time a new user joins I sent the users a message using

client.on ("guildMemberAdd", member => {

member.send("WELCOME")})

Now, is there any way for the bot to react to that message? Thanks!

Upvotes: 1

Views: 64

Answers (2)

Frustrated programmer
Frustrated programmer

Reputation: 711

Similar to Syntle's answer, but uses promises instead. (My preferred use)

   member.send("WELCOME").then(function(msg){
       msg.react("😀");
   }

Upvotes: 1

Syntle
Syntle

Reputation: 5174

You need to contain member.send() in a variable and then use the .react() method on it.

So your solution is:

const msg = await member.send("WELCOME")
await msg.react("🥚");

Upvotes: 1

Related Questions