What I'm trying to do is to change the color of an embed when someone adds a reaction. The struggle I'm currently facing is making it the if statement fire. So haven't gotten very far.
I'm also probably not targeting any specific embed. As the embed (suggestionsEmbed) has been sent multiple times.
EDIT: Updated with current code. This is working except for one thing. No embed other than the last sent can be edited. See what I mean here.
// SUGGESTIONS EMBED - BEGINS
var suggestionsEmbed;
client.on('messageCreate', async message => {
if (message.channel.id === channelSuggestions && !message.author.bot) {
db.add('counterP.plus', 1);
const embed = new MessageEmbed()
.setColor('#f9db73')
.setTitle(`Suggestion #${await db.fetch('counterP.plus') + await db.fetch('counterM.minus')}`)
.setDescription(message.content)
.setAuthor({ name: message.author.username, iconURL: message.author.displayAvatarURL() })
.setTimestamp()
.setFooter({ text: message.author.id });
suggestionsEmbed = await message.channel.send({ embeds: [embed] })
suggestionsEmbed.react('')
suggestionsEmbed.react('');
message.delete({ timeout: 0 });
console.log(db.fetch('counterP.plus'));
}
})
// SUGGESTIONS EMBED - ENDS
// CHANGE EMBED COLOR - BEGINS
const suggestionsApproved = '';
const suggestionsDenied = '';
client.on('messageReactionAdd', (reaction, user) => {
if (reaction.message.channel.id === channelSuggestions) {
if (reaction.emoji.name === suggestionsApproved && reaction.message.id === suggestionsEmbed.id) {
const suggestionsEmbedApproved = new MessageEmbed(suggestionsEmbed.embeds[0]).setColor('#76de51')
suggestionsEmbed.edit({ embeds: [suggestionsEmbedApproved] });
}
}
})