'Discord.js v13 delete message after a certain amount of time
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 ?
Solution 1:[1]
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();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Skully |