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

170
Visualizações
How to send reactions and also awaitReactions on the same message

Ok, so a little bit of background, I am very new to Javascript and am making a discord bot to play simple text based games, currently I am recreating TicTacToe, I have the game fully working with commands but want to utilize discord reactions as it is generally easier for a user to just click the corresponding button than to type out an entire command.

Here I am trying to prompt the user to pick either Xs or Os, I have been able to react to my own message with with the proper emojis ❎ and 🅾️, but I am having trouble implementing the awaitReactions function.

module.exports = function (message, args){
    breakme: if(boardSet == false){
        let emb = embedMake ("Board Set:", displayBoard.join("") + "\nSince this is a two player game, someone needs to be Xs and someone needs to be Os? (react with ❎ to be X or 🅾️ to be O)" )
        message.channel.send({embeds: [emb]})
        .then(sentEmbed => {
            sentEmbed.react("❎")
            sentEmbed.react("🅾️")
        })
        
        .awaitReactions({max: 2, time: 60000, errors: ['time'] })
            .then(collected => {

                if (collected.emoji.name === '❎') {
                    message.channel.send('You reacted with a ❎');
             
                } else if(collected.emoji.name === '🅾️'){
                    message.channel.send('You reacted with a 🅾️');
                    
                }else{
                    message.channel.send("You didn't react with ❎ or 🅾️");
                }
        })
        
        boardSet = true;
    }
}

From what I've seen, people set it up by doing message.awaitReactions, but if I were to do it in that fashion, I would only be awaiting reactions on the original command that starts the game to begin with, when I want to be awaiting reactions from my response to that command.

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