Up to discord.js v12, my bot would delete messages it posted like this :
JavaScript
x
7
1
message.reply("text")
2
.then(msg => {
3
message.delete()
4
msg.delete({timeout: 5000}) //amount of time I want it to wait in milliseconds
5
})
6
.catch()
7
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 :
JavaScript
1
6
1
message.reply("text")
2
.then(repliedMessage => {
3
setTimeout(() => repliedMessage.delete(), 5000);
4
});
5
.catch();
6