So I'm making this thing where you can do this command and it checks if you purchased a thing or not (it gets sent to staff). So I have that bit working but I'm stuck on how to do something like where the bot says, "Are you done with this?" and it reacts to that message with the ❎ and ✅. And when you press one of them, it does the code.
Or make it so it only reacts with the tick and detects when someone reacted to it.
Currently I have:
message.channel.send(new Discord.RichEmbed().setTitle("Rank-Up Application:").setDescription(`**If you wish to send an application to get Ranked-Up in the Discord & ROBLOX Group, this is the right place to do it! **`).setFooter("When you have done that, say done.").setColor("#ff4757")).then(() => {
message.channel.awaitMessages(filter, { maxMatches: 1, time: 90000, errors: ['time']})
.then(collected => {
message.channel.send(":grey_exclamation: **Sending...**")
client.channels.get(`622386044914106388`).send(new Discord.RichEmbed().setTitle("New Rank-Up!").addField(`**The user ${username} has sent in an application to get ranked. Please check the following links to see if you should rank him. Remember: True = Owns Class, False = Doesn't own Class.**`).addField(`Plus: ${plus}`).addField(`Advanced: ${advanced}`).setTimestamp().setFooter("When you have done that, say done.").setColor("#ff4757"))
So that last line of code is the bit it should say the message under. I'm quite stuck on this and don't even know what start code I should put.
Maybe something like this is what you're looking for. I use it on tickets for people to close them. Works fine for me.
message.channel.send(`Message that will have reactions on it.`).then(msg => {
msg.react('❌');
// Wait 300ms to make sure the tick emoji is made after the first reaction. Just incase the API is on the slow side.
setTimeout(function(){msg.react('✅');},300);
// Create a filter to collect, making sure it only checks for non bot users.
// If you want to check for the message author use user.id == message.author.id
const filterEmojis = (reaction, user) => {
return ['❌', '✅'].includes(reaction.emoji.name) && user.bot == false;
};
// Await for a user to react as per our filter above.
msg.awaitReactions(filterEmojis, {time: 60000}).then(collected => {
const reaction = collected.first();
// Check if the reaxtion is an X.
if(reaction.emoji.name === '❌') {
// Do something when this is reacted too.
}
// Check if the reaxtion is a tick.
if(reaction.emoji.name === '✅') {
// Do something when this is reacted too.
}
}).catch(() => {
// Catch errors.
});
}).catch(console.error);
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.