;(function(){
const authToken = JSON.parse(localStorage.token);
const channel = window.location.href.split('/').pop();
const baseURL = `https://discordapp.com/api/channels/${channel}/messages`;
const headers = {"Authorization": authToken };
let clock = 0;
let interval = 500;
function delay(duration) {
return new Promise((resolve, reject) => {
setTimeout(() => resolve(), duration);
});
}
fetch(baseURL + '?limit=100', {headers})
.then(resp => resp.json())
.then(messages => {
return Promise.all(messages.map((message) => {
return delay(clock += interval).then(() => fetch(`${baseURL}/${message.id}`, {headers, method: 'DELETE'}));
}));
}).then(() => console.log("Done!"));
}());
All you have to do is open a browser, like chrome, open discord and open the channel you want to delete all messages from. Then open the dev tools (ctrl + shift + i
in chrome) and paste this into the console window of the dev tools. Then press enter... after it delete all it can see up to 100 messages you'll have to click load more messages and then run it again.