I've been trying to code a discord bot in discord.js with a command that allows user to react to the message and receive a role. This is my current code. I am unsure how to make it where when a user's added a reaction it gives a role and when the reaction for a user has removed the role it took away.
const { RichEmbed } = require('discord.js');
const Discord = require("discord.js");
const colors = require("../colors");
const botconfig = require("../botconfig");
exports.run = async (client, message, args) => {
await message.delete().catch(O_o=>{});
const role1 = message.guild.roles.get('688477558982836344'); // Replace with Updates ID
const role2 = message.guild.roles.get('688477690344374283'); // Replace with Events ID
const role3 = message.guild.roles.get('688477467840872452'); // Replace with QOTD ID
const role4 = message.guild.roles.get('688477868078137369'); // Replace with Polls ID
const role5 = message.guild.roles.get('687498488295981069'); // Replace with Social Media ID
const embed = new Discord.RichEmbed()
.setTitle('Pinged Roles')
.setDescription(`
Tip: *Double React to remove a role*
❤️ ${role1.toString()}
???? ${role2.toString()}
???? ${role3.toString()}
???? ${role4.toString()}
???? ${role5.toString()}
`)
.setColor(colors.purple)
.setFooter('mc.advancius.net')
message.channel.send(embed).then(async msg => {
await msg.react('❤️');
await msg.react('????');
await msg.react('????');
await msg.react('????');
await msg.react('????');
});
}
module.exports.help = {
name: "roles"
};