I've only gotten the first "moneybag" emoji to react to the newest message in the channel, which is the embed that the bot sends, however, I want the bot to react to the new embed with both the "money bag" and "ticket" emojis and so far it will react with the "money bag" emoji but, errors out when it tries to react with the "ticket" emoji. How do I get the bot to react to the new embed with both emojis?
if (message.content === '-new') {
const filter = (reaction, user) => {
return ['💰', '🎟'].includes(reaction.emoji.name) && user.id === message.author.id;
};
const embed = new Discord.RichEmbed()
.setTitle('Ticket')
.setColor('DC3BF5')
.setDescription('Thank you for showing interest in purchasing a commission from the Quadra Build Team, or for lending us your time through Support. Make sure you have read our #terms-of-service channel before requesting a commission. We are glad to make your prolific ideas & requests come true!\n\n If you accidentally created a ticket by mistake, use (-del) to delete the ticket.\n\n React with :moneybag: to order a Commission.\n React with :tickets: to create a Support Ticket.\n -------------------------------------------------------------------------------------------------')
message.channel.send(embed)
.then(m => m.react('💰'))
.then(m => m.react('🎟'))
.catch(m => {
console.error('Emoji failed to react.');
});
message.awaitReactions(filter, { max: 1, time: 0, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '💰') {
collected.on('collect', () => {
m.clearReactions();
var secondEmbed = new Discord.RichEmbed()
.setTitle('Ticket')
.setColor('DC3BF5')
.setDescription('lol')
});
} else {
collected.on('collect', () => {
m.clearReactions();
var secondEmbed = new Discord.RichEmbed()
.setTitle('Ticket')
.setColor('DC3BF5')
.setDescription('lol 2')
});
}
})
.catch(collected => {
message.channel.send('You didn\'t react with either of the specified emojis.');
});
}
Message#react returns a MessageReaction in a promise so you need to do:
message.channel.send(embed)
.then(m => m.react('💰'))
.then(m => m.message.react('🎟'))
or
message.channel.send(embed)
.then(m => {
m.react('💰')
m.react('🎟')
});
or with async await:
const m = await message.channel.send(embed);
await m.react('💰')
await m.react('🎟')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With