6
votes

So I am trying to make the bot react to it's own message, for a polls feature of my discord server, and I am wondering how to make the bot add reactions to it's message? (Currently, it adds the reaction to the person who executed the .suggestion command.)

client.on('message', message => {
  if (message.content.startsWith('.suggestion')) {

        const channel = message.guild.channels.find('name', 'polls');
        const args = message.content.slice(12).trim().split(/ +/g);
        let suggestion = args.slice(0).join(" ");
        if (!channel) return;

        let embed = new Discord.RichEmbed()
        .setColor("#55FFFF")
        .setDescription('▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n▬▬▬▬▬▬▬▬▬**«    Vexil Player Suggestion    »**▬▬▬▬▬▬▬▬▬▬\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n\n**Suggested By »** ' + message.author + '\n\n**Suggestion »** ' + suggestion + '\n\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬\n▬▬▬▬▬▬▬▬▬▬▬▬**«**     @everyone     **»**▬▬▬▬▬▬▬▬▬▬▬▬\n▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬')
        .setFooter('Vexil', client.user.avatarURL)

    channel.send(embed);
    message.react("????")
    message.react("????");

  }
});

Thank you in advanced for your help and time. <3

3

3 Answers

6
votes

You can react directly after the message is sent by using .then()

channel.send(embed).then(sentEmbed => {
    sentEmbed.react("👍")
    sentEmbed.react("👎")
})
2
votes

It's easy!

channel.send(embedName).then(sentMessage => {
  const emoji = message.guild.find('name', 'emojiName');
  sentMessage.react(emoji);
});
1
votes

Based on the suggestions in How Find Emojis By Name In Discord.js and personal testing, using

channel.send(embed).then(function(message) {
    message.react(message.guild.emojis.find('name', "emojiName"))
});

will send your message and then react with the find result of emojiName (be as specific as possible)