尝试使之工作:
try{
message.author.send(helpEmbed)
}
catch(error) {
message.channel.send("Your dms are closed,cannot send help message.")
return;
}
message.react('✅')
但是catch(error)对于承诺错误不起作用(因为实际错误日志将其称为“ UnhandledPromiseRejectionWarning”)。而且我不能使用.catch(()=> etc,因为那样我就不能在其中放一个return,这意味着它不会停止该消息。在try / catch中,您不能离开该消息。 catch()为空。