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);
});
});
}