-
-
Save IMcPwn/0c838a6248772c6fea1339ddad503cce to your computer and use it in GitHub Desktop.
// Turn on Developer Mode under User Settings > Appearance > Developer Mode (at the bottom) | |
// Then open the channel you wish to delete all of the messages (could be a DM) and click the three dots on the far right. | |
// Click "Copy ID" and paste that instead of LAST_MESSAGE_ID. | |
// Copy / paste the below script into the JavaScript console. | |
// If you're in a DM you will receive a 403 error for every message the other user sent (you don't have permission to delete their messages). | |
var before = 'LAST_MESSAGE_ID'; | |
clearMessages = function(){ | |
const authToken = document.body.appendChild(document.createElement`iframe`).contentWindow.localStorage.token.replace(/"/g, ""); | |
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 + '?before=' + before + '&limit=100', {headers}) | |
.then(resp => resp.json()) | |
.then(messages => { | |
return Promise.all(messages.map((message) => { | |
before = message.id; | |
return delay(clock += interval).then(() => fetch(`${baseURL}/${message.id}`, {headers, method: 'DELETE'})); | |
})); | |
}).then(() => clearMessages()); | |
} | |
clearMessages(); |
Doesn't work anymore.
Doesn't work anymore.
EDITED: WORKING AS JAN-2020
Take a look at this https://github.com/victornpb/deleteDiscordMessages
full disclaimer, I'm the author.
Doesn't work anymore.
WORKING AS AUG-2019
Take a look at this https://github.com/victornpb/deleteDiscordMessages
full disclaimer, I'm the author.
Works! thank you! - just wish I could delete all messages in all channels :P
Doesn't work anymore.
WORKING AS AUG-2019
Take a look at this https://github.com/victornpb/deleteDiscordMessages
full disclaimer, I'm the author.
didnt work man
WORKING AS AUG-2019
Take a look at this https://github.com/victornpb/deleteDiscordMessages
full disclaimer, I'm the author.didnt work man
It is working as JAN-2020
Works for me still on Chromium, but not firefox. Works on most channels, that is. For one channel I do get
authorID="ommited" guildId="618621882110967809" channelId="663328918719168514" afterMessageId="" beforeMessageId="" hasLink=false hasFile=false
Error searching messages, API responded with status 403!
{"message":"Missing Access","code":50001}
Despite being able to hand delete messages in that channel aslo
I was able to delete only my messages from the private text message. How can I delete the other person message. Please advice
I found this repo pretty useful. Its fast and easy to use.
Senior Software Developer here. Nice work, thanks for saving me some time!
Status on 3/19/2021: WORKING
https://gist.github.com/jsoctocat/586feb9e530e61e6f499f7b7773b4df3
Please be EXTREMELY careful of downloading applications. Make sure you trust them with the permissions you give them.
Code currently working found here: https://github.com/TheOutride/Discord-Deleting-DM