sleepy-discord
sleepy-discord copied to clipboard
Delete all messages in a Discord channel
Is it possible to delete all messages from a Discord channel ?
yes with bulk delete, however, it's going to take a while to get all the message ids
Ok, I can get the lastMessageID, but how can I get IDs of previous messages?
use getMessages, try not to spam it tho.
Also can't you just delete a channel and recreate?
Thanks, now I figured it out! However, on the run() function, an exception of type SleepyDiscord::ErrorCode with code 5005 is sometimes generated (if spamming), so I had to add exception handling and wrap it in a loop, as shown below. I hope so normal (I mean cycle).
thread t1( [&client]() {
while(true) {
try {
client.run();
} catch (SleepyDiscord::ErrorCode i) {}
}
});
t1.detach();