Ya tengo este código para publicar una inserción y agregar una reacción, solo me pregunto cómo haría para agregar un rol a un usuario cuando agrega la reacción.
if (message.content.startsWith(`${prefix}rr`)) { let embed = new MessageEmbed() .setColor("#ffffff") .setTitle("📌 Our Servers Rules 📌") .setDescription("To keep our server safe we need a few basic rules for everyone to follow!") .setFooter("Please press ✅ to verify and unlock the rest of the server!") .addFields( { name: "1.", value: "Stay friendly and don't be toxic to other users, we strive to keep a safe and helpful environment for all!", }, { name: "2.", value: "Keep it PG-13, don't use racist, homophobic or generally offensive language/overly explicit language!", }, { name: "3.", value: "If you want to advertise another server/website etc please contact me first!", }, { name: "4.", value: "Don't cause drama, keep it civil!" }, { name: "5.", value: "If you have any questions please contact me @StanLachie#4834", } ); message.channel.send({ embeds: [embed] }).then((sentMessage) => { sentMessage.react("✅"); }); }Es posible que desee consultar esta página de la Guía de Discord.js . Pero en resumen...
const filter = (reaction, user) => { return reaction.emoji.name === '✅' && user.id === message.author.id; }; const collector = message.createReactionCollector({ filter }); collector.on('collect', (reaction, user) => { const role = await message.guild.roles.fetch("role id"); message.guild.members.fetch(user.id).then(member => { member.roles.add(role); }); });