Discord.JS从.awaitMessages()获取所收集消息的内容

时间:2020-03-27 15:26:12

标签: javascript node.js discord.js message

我正在使用验证码设置密码重置请求系统,并且需要获取.awaitMessages()收集的消息的内容。 (这是在DM中)我曾尝试使用.then变量和message变量进行多种组合。我能得到的最接近的信息是告诉我启动命令的消息的内容,但是我需要收集的消息的内容。我在其他任何地方都找不到能解释这一点的东西。不过,我对此很陌生,所以我可能只是愚蠢。下面的代码是版本,它为我提供了初始化命令的消息,而不是所收集的消息。任何见解都非常感激:D

msg.channel.send("Type what you see now!").then(() => {
          msg.channel.awaitMessages(filter, { max: 1, time: 30000, errors: ['time'] })
              .then(collected => {
                     if (msg.content !== captchaanswer) {
                  msg.channel.send("Sorry, that's incorrect. You have one attempt remaining.")
                  //debug to see what message it's getting. appears to getting the starter message, not the collected one
                  msg.channel.send(msg.content)
                  msg.channel.send(captchaanswer)
//end debug lol
                  const filter2 = response => {

                     return response.content.toLowerCase(); // item.answers.some(answer => answer.toLowerCase() ===
                   };

                   msg.channel.send("Type what you see again.").then(() => {
                      msg.channel.awaitMessages(filter2, { max: 1, time: 30000, errors: ['time'] })
                        .then(collected => {
                             if (msg.content != captchaanswer) {
                                msg.channel.send("Sorry, that's incorrect. Try again in a while.")```
                                } else {

//...

0 个答案:

没有答案