【问题标题】:Discord.js Reaction not collecting awaitReactionsDiscord.js 反应未收集 awaitReactions
【发布时间】:2021-05-11 23:58:24
【问题描述】:

我在让我的反应收集器收集反应时遇到问题,它只是超时任何想法都会受到赞赏。

        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!`)
    





    }}

【问题讨论】:

    标签: javascript discord discord.js


    【解决方案1】:

    您是否尝试过首先要求表情符号,然后在您的代码中使用它?我的意思是:const reaction1Emoji = '1️⃣'const reaction2Emoji = '2️⃣' 然后将 emoji.name 替换为 reaction1Emojireaction2Emoji

    【讨论】:

      猜你喜欢
      • 2023-03-18
      • 2020-11-30
      • 1970-01-01
      • 1970-01-01
      • 2020-07-06
      • 2021-03-14
      • 2020-05-09
      • 2021-08-05
      • 2021-05-31
      相关资源
      最近更新 更多