收集邮件时出现问题

时间:2019-05-20 10:46:57

标签: javascript discord.js

当我对此进行测试时,它工作正常,但该漫游器始终发送"no one said uwu :("

client.on('message', message => {
  if (message.content === '$uwu') {
    message.channel.send('say uwu! - i will count how many people say uwu in 30 seconds')
      .then(() => {
        message.channel.awaitMessages(response => response.content === 'uwu', {
            max: 100000000,
            time: 5000,
            errors: ['time'],
          })
          .then((collected) => {
            message.channel.send(`${collected.first.size} people said uwu`);
          })
          .catch(() => {
            message.channel.send('no one said uwu :(');
          });
      });
  }
});

2 个答案:

答案 0 :(得分:0)

由于您有时间限制,因此该时间限制之后的消息始终会创建异常。但是请注意以下几点:

.catch((collected) => {
    if (collected.size === 0) {
        message.channel.send('no one said uwu :(');
    }
});

答案 1 :(得分:0)

解决我问题的代码是

apply plugin: 'com.google.protobuf'

buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
  }
}

protobuf {
  protoc {
    artifact = "com.google.protobuf:protoc:3.7.1"
  }
  plugins {
    grpc {
      artifact = 'io.grpc:protoc-gen-grpc-java:1.20.0'
    }
  }
  generateProtoTasks {
    all()*.plugins {
      grpc {}
    }
  }
}