Reputation: 23
I am trying to delete the message I sent after 5 seconds
msg.channel.send(Embed).then(messageReaction => {
messageReaction.react("❌");
messageReaction.react("✔️");
messageReaction.delete(5000); // This line causes the error
But it doesn't work. This is the error I get:
> (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)
Upvotes: 2
Views: 395
Reputation: 5174
Since discord.js v12 you need to pass the options such as timeout and reason as an object so your solution is:
messageReaction.delete({ timeout: 5000 });
Upvotes: 2