我正在尝试删除5秒钟后发送的邮件
msg.channel.send(Embed).then(messageReaction => {
messageReaction.react("❌");
messageReaction.react("✔️");
messageReaction.delete(5000); // This line causes the error
但是它不起作用。这是我得到的错误:
> (node:54020) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied options is not an object.
at Message.delete (C:\Users\Josh\Desktop\Discord Bot\node_modules\discord.js\src\structures\Message.js:501:44)
at C:\Users\Josh\Desktop\Discord Bot\index.js:45:29
at processTicksAndRejections (internal/process/task_queues.js:97:5)
答案 0 :(得分:2)
自discord.js v12起,您需要将超时和原因等选项作为对象传递,因此您的解决方案是:
messageReaction.delete({ timeout: 5000 });