How do I make it so that 2 people (me and the person I @) have to press the check button before it confirms?
my code:
let nine = await message.channel.send(embed)
await nine.react('✅');
await nine.react('❌');
const filter1 = (reaction, user) => reaction.emoji.name === '✅' && user.id === message.author.id;
const col1 = nine.createReactionCollector(filter1, { time: 30000, dipose: true, max: 1 });
const filter2 = (reaction, user) => reaction.emoji.name === '❌' && user.id === message.author.id;
const col2 = nine.createReactionCollector(filter2, { time: 30000, dipose: true, max: 1 });
col1.on('collect', async r => {
// the rest of my code```
This should work (you will have to adapt this to your code)
const mention = message.mentions.users.first();
const filter = (reaction, user) => [message.author.id, mention.id].includes(user.id) && reaction.emoji.name === '✅'
const reaction = await message.react('✅')
let res = false
let reactions = await message.awaitReactions(filter, {max: 2, time: 30000, errors: ['time']})
const check = reactions.mapValues(r => r.user.id)
if(check.size === 2) res = true
if(res) {
//they both reacted
} else {
//they didn’t both react
}
If it didn't work tell me what happened. I didn't get to test it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.