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

163
Views
Grabbing user id/user name from reactions Discord.js V13

I'm trying to make a custom teambuilder for my Discord channel. When a user reacts to a specific emoji, they would get placed in the specified team. The problem m getting is, idk how to grab the user id so I can store their userid/username in the team array to be displayed. I've tried going through the documentation but I don't think I completely understand the syntax. Here's a snippit of my code.

const {Client, Intents, MessageEmbed, GuildMember} = require("discord.js")

const client = new Client({ intents:[Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.GUILDS, 
Intents.FLAGS.GUILD_MESSAGE_REACTIONS] });
require('dotenv').config();

client.on("ready", () => {
  console.log("Bot is online")
})
client.on("messageCreate", async (message) => {

    if (message.author.bot) return;

    if (message.content.toLowerCase().startsWith('!formevent')) 
    {
        console.log ("A message got sent")
        let args = message.content.split(" ");
        let scrimSize = args[1];                

        if (scrimSize == 10){

            message.channel.send("Scrim size = "+ scrimSize)

            const redSide = ['Test data for red team'];
            const blueSide = ['Test data for blue team'];
            redSide.length = 5;
            blueSide.length = 5;

            const embed = new MessageEmbed()
                .setTitle ("Scrim")
                .setDescription ("React with ๐Ÿ’™ to join blue team.\n React with โค๏ธ to 
join red team.")

            const embed2 = new MessageEmbed()
                .setTitle ("Blue Team (5 players)")
                .setDescription (blueSide[0])

            const embed3 = new MessageEmbed()
                .setTitle ("Red Team (5 players)")
                .setDescription (redSide[0])


                let msg = await message.channel.send({embeds: [embed, embed2, embed3]})

                await msg.react('๐Ÿ’™');
                await msg.react('โค๏ธ');
                await msg.react('โŒ');
                await msg.react('โœ…');
            

                const filter =(reaction, user) =>  
                
            reaction.emoji.name === '๐Ÿ’™' || reaction.emoji.name === 'โค๏ธ' //&& user.id 
=== '213832006486720512'     
                msg.awaitReactions({ filter, time: 5000})
              
                    .then (collected => console.log( `Collected ${collected.size} 
reactions`))
                    
                        .catch(console.error);
                        //console.log (GuildMember.Id);             

        //console.log(redSide[0]);
    } 
about 4 years ago ยท Juan Pablo Isaza
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!