Delete Messages in a Channel (Not Purge)

How would I delete all the messages in a channel without knowing how many messages are in the channel?
9 Replies
noby
nobyOP3y ago
Here's what I have now:
await channel.messages.cache.forEach(async (message) => {
await message.delete().catch(err => console.log(err)).finally(console.log("deleted all the messages"));
});
await channel.messages.cache.forEach(async (message) => {
await message.delete().catch(err => console.log(err)).finally(console.log("deleted all the messages"));
});
monbrey
monbrey3y ago
Can't, just delete the channel and remake it
noby
nobyOP3y ago
But it isn't working
monbrey
monbrey3y ago
That's insane API spam
noby
nobyOP3y ago
tragic So there's no other way except purge?
monbrey
monbrey3y ago
bulkDelete will go back 14 days at most
noby
nobyOP3y ago
Yep ik
monbrey
monbrey3y ago
Clone channel, delete original is best way
noby
nobyOP3y ago
rip then ok
Want results from more Discord servers?
Add your server