hey, i am new to coding and was looking to create a discord bot that would DM you a a message when you react to a message, i was looking at other threads and they where out-dating or wouldnt help. can someone help me?
let msgId = [];
client.on("message", (message) => {
if(message.content === "!command") {
message.channel.send(
new discord.MessageEmbed()
.setAuthor("embed")
.setDescription("react me with 😆")
).then(message => {
msgId.push(message.id);
message.react("😆");
})
}
})
client.on('messageReactionAdd', (reaction, user) => {
if(user.id !== bot.user.id) {
if(reaction.message.id === msgId[0]) {
user.send("you reacted to my message!");
}
}
});
source : javascript - Trying to do discord.js on react emoji get dm - Stack Overflow
Basically, someone says !command and bot will send an embed and if someone reacts with it would send a dm to user.
4 Likes
Hey, thanks for the response. I dont know if it works yet because i dont know how to input my message.
I want a message like this:
Hello,
This is an example
in between hello and this, i switched lines, when i switch lines it pops a ton of errors. is there some sort of symbol i have to show to switch for me?