简体   繁体   English

Discord.js 反应未收集 awaitReactions

[英]Discord.js Reaction not collecting awaitReactions

I'm having problems getting my reaction collector to collect reactions it just times out any ideas would be appreciated.我在让我的反应收集器收集反应时遇到问题,它只是超时任何想法都会受到赞赏。

        message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.name == '1️⃣' || reaction.emoji.name == '2️⃣'),
        { max: 1, time: 30000 }).then(collected => {
          
                if (collected.first().emoji.name == '1️⃣') {
             let roll1 = util.randomroll(1, 101)
                if(roll1 > 50){
                   
                    bot.db.add(`${message.author.id}.balance`, amount);
                    message.channel.send(bot.embed(`**${quidteam1t}** WON!!! YOU GAINED **${amount}**`));

                }else{
                    bot.db.add(`${message.author.id}.balance`) -= amount;
                    message.channel.send(bot.embed(`**${quidteam2t}** Won and you lost **$${amount}** better luck next time!`))
                }


                }
        }).catch(collected => {
            message.reply('you didnt react');
        });
   console.log(`${message.author.username} used QuidditchBet to start a betting event!`)
    





    }}

Did you try to constantly ask for emojis first and then use it in your code?您是否尝试过不断要求表情符号,然后在您的代码中使用它? What i mean is: const reaction1Emoji = '1️⃣' and const reaction2Emoji = '2️⃣' and then replace where emoji.name with reaction1Emoji and reaction2Emoji !我的意思是: const reaction1Emoji = '1️⃣'const reaction2Emoji = '2️⃣'然后将 where emoji.name替换为reaction1Emojireaction2Emoji

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM