message.channel.send({embeds:[embed]}).then(msg => { const reactionControls = { UP: '\ud83d\udc4d', DN: '\ud83d\udc4e' } msg.react(reactionControls.UP).then( r => { msg.react(reactionControls.DN) const filter = (reaction, user) => Object.values(reactionControls).includes(reaction.emoji.name); const collector = msg.createReactionCollector({ filter, time: time }); let thumbsUp = 0; let thumbsDwn = 0; collector.on('collect', (reaction) => { switch (reaction.emoji.name) { case reactionControls.UP: thumbsUp = reaction.count-1; break; case reactionControls.DN: thumbsDwn = reaction.count-1; break; } }) collector.on('remove', (reaction) => { switch (reaction.emoji.name) { case reactionControls.UP: thumbsUp = reaction.count-1; break; case reactionControls.DN: thumbsDwn = reaction.count-1; break; } }) collector.on('end', collected => { console.log(thumbsUp) msg.edit({embeds:[embed.setDescription('Poll CLOSED!')]}) if(thumbsUp > thumbsDwn){ resultsEmbed = new Discord.MessageEmbed() .setTitle('Results for "' + question + '"') .setDescription(`šŸ‘ - ${thumbsUp} Up Votes\n\nšŸ‘Ž - ${thumbsDwn} Disagrees\n`) .setColor('#00fa00'); //green message.channel.send({embeds:[resultsEmbed]}); } else if (thumbsUp < thumbsDwn) { resultsEmbed = new Discord.MessageEmbed() .setTitle('Results for "' + question + '"') .setDescription(`šŸ‘ - ${thumbsUp} Up Votes\n\nšŸ‘Ž - ${thumbsDwn} Disagrees\n`) .setColor('#fa0000'); //red message.channel.send({embeds:[resultsEmbed]}); } else { resultsEmbed = new Discord.MessageEmbed() .setTitle('Results for "' + question + '"') .setDescription(`šŸ‘ - ${thumbsUp} Up Votes\n\nšŸ‘Ž - ${thumbsDwn} Disagrees\n`) .setColor('#00067d'); //blue message.channel.send({embeds:[resultsEmbed]}); } }) }) })