Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Discord.js-捕获超时错误时给出错误_Javascript_Node.js_Discord.js - Fatal编程技术网

Javascript Discord.js-捕获超时错误时给出错误

Javascript Discord.js-捕获超时错误时给出错误,javascript,node.js,discord.js,Javascript,Node.js,Discord.js,我对你的反应有问题。这是我的密码: msg.awaitReactions(filter, {max: 1, time: 30000, errors:["time"]}) .then(collected => { const reaction = collected.first(); if (reaction) { con

我对你的反应有问题。这是我的密码:

msg.awaitReactions(filter, {max: 1, time: 30000, errors:["time"]})
                .then(collected => {
                    const reaction = collected.first();
                    if (reaction) {
                    const selected = this.game_data[Object.keys(this.game_data)[ReactionToNumber(reaction.emoji.name)-1]]
                        .protected = true;
                    msg.delete();
                    now_user.private_chat.send(selected.name+" kişisini korudun!");
                    }
                    
                })
                .catch(collected => {
                    now_user.private_chat.send("Bu el kimseyi korumadın.");
                });
在Message.js中发生错误:发生异常:映射(0)

我不希望它给出错误,我希望它捕获超时。我怎样才能解决这个问题

我的英语不是很好。我尽可能多地翻译

    awaitReactions(filter, options = {}) {
        return new Promise((resolve, reject) => {
      const collector = this.createReactionCollector(filter, options);
      collector.once('end', (reactions, reason) => {
        if (options.errors && options.errors.includes(reason)) reject(reactions); //Exception has occurred: Map(0)
        else resolve(reactions);
      });
    });
  }