Up to discord.js v12, my bot would delete messages it posted like this :
message.reply("text")
.then(msg => {
message.delete()
msg.delete({timeout: 5000}) //amount of time I want it to wait in milliseconds
})
.catch()
However, now that I updated discord.js modules to v13, the message is deleted instantly.
Is there a new method to do that, or am I doing it wrong ?
Advertisement
Answer
Turns out that, as stated in the documentation here, msg.delete() does not accept options anymore, meaning the correct code is now this :
message.reply("text")
.then(repliedMessage => {
setTimeout(() => repliedMessage.delete(), 5000);
});
.catch();