This works best in Firefox, I haven't tested it in Chrome. On the desktop client, it has trouble getting the Auth token from LocalStorage so you need to grab it from a request's headers and replace the parameter "authToken" on the last line with it. There's instructions on how to do that below.
Preqrequisites:
- computer
- general knowledge of your browser's inspector/developer tools
- possibly even a brain
RUN AS ADMIN ONLY! WILL DELETE ALL MESSAGES!!!
The script uses the internal id values Discord refers to the selected server and user by. The easy way to do this is to enable Developer Mode in your Discord settings, after which you can simply right click the server's icon and click "Copy ID". Otherwise, you can grab the server's id from the URL, and you can get your own id using the network tab of your browser's inspector.
This is now automated on Firefox, despite Discord "hiding" the localStorage variable from the DOM. On Chrome and the desktop client it seems to not be in localStorage (???) so you need to get it from a network request. Follow these easy steps:
- Open the inspector (Ctrl-Shift-I)
- Open the Network tab of your inspector
- Open any request to Discord's servers
- Look for the "Authorization" request header. Copy that into the line
var authToken = ""
. For example it might look likevar authToken = "your_auth_token_goes_here"
Copy-paste the script into the javascript console, and replace ____________guild_id_here_______________
and ____________author_id_here______________
with the respective ids copied in Step 1. If you're on Chrome or Desktop Client enter your auth token as well (see above).
Strike the Return key on your keyboard...come on, this is not rocket science man.
How do I use this to delete DMs?
Replace searchURL
with https://discordapp.com/api/v6/channels/${guild_id}/messages/search?author_id=${author_id}&include_nsfw=true
. For example, replace this line:
const searchURL = `https://discordapp.com/api/v6/guilds/${guild_id}/messages/search?author_id=${author_id}&include_nsfw=true`
with
const searchURL = `https://discordapp.com/api/v6/channels/${guild_id}/messages/search?author_id=${author_id}&include_nsfw=true`
hello, how can i make this delete messeges with a specific word? &content= doesnt work for some reason