Skip to content

Instantly share code, notes, and snippets.

View steckel's full-sized avatar

Curtis Steckel steckel

  • San Francisco, CA
View GitHub Profile
@steckel
steckel / delete-all-messages.js
Last active January 18, 2019 07:31 — forked from IMcPwn/delete-all-messages.js
Delete all messages in a Discord channel
// 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`;