Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda