I'm trying to make a verification system for my server, but I can't get it to work.
I want the users to react with an emoji to a message (embed) and then they get a role added.
async execute(client, message, args) {
const channel = '890657345145823252';
const verifyrole = message.guild.roles.cache.find(role => role.id === '906506388598054922');
const verifyemoji ='✅';
let embed = new Discord.MessageEmbed()
.setTitle(`**React here!**`)
.setDescription('React here to get access to the Server!\n\n'
+ ` react with: ${verifyemoji} `);
let MessageEmbed = await message.channel.send(embed);
MessageEmbed.react(verifyemoji);
client.on('messageReactionAdd', async(reaction, user) => {
if(reaction.message.partial) await reaction.message.fetch();
if(reaction.partial) await reaction.fetch();
if(user.bot) return;
if(reaction.message.channel.id == channel) {
if(reaction.emoji.name === verifyemoji) {
await reaction.message.guild.members.cache.get(user.id).roles.add(verifyrole);
}
} else {
return;
}
})
}
}