Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

338
Views
Discord.js v13 Reaction Roles

I already have this code to post an embed and to add a reaction, I'm just wondering how I would go about adding a role to a user when they add the reaction?

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("โœ…");
    });
}
about 4 years ago ยท Juan Pablo Isaza
1 answers
Answer question

0

You may want to check this Discord.js Guide page. But in summary...

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);  
    });
});
about 4 years ago ยท Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!