This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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. | |
// Copy/paste the below script into the JavaScript console. | |
// invoke the function `clearMessages("username", "messageId")` | |
// where username is optional username to filter off of and where messageID is an optional ID that you wish to retain, but delete everything before | |
function clearMessages(username, before) { | |
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`; |