get all mesages after a specific time

Im making a purge command but when i try to delete messages it says it can only delete messages that are younger than 14 days. so i made a date object and made it so the date was 14 days before the current date but it seems that the fetch function needs a snowflake, so how do i convert my date to a snowflake code:
const date = new Date();
date.setDate(date.getDate() - 14);
const fetched = await interaction.channel.messages.fetch({limit: amount});
interaction.channel.bulkDelete(fetched);
const date = new Date();
date.setDate(date.getDate() - 14);
const fetched = await interaction.channel.messages.fetch({limit: amount});
interaction.channel.bulkDelete(fetched);
DT
d.js toolkit199d ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
S
Syjalo199d ago
You can simply do channel.bulkDelete(amount, true)
K
Kay199d ago
oh thx