Skip to content

Instantly share code, notes, and snippets.

@frainfreeze
Last active July 12, 2020 07:31
Show Gist options
  • Save frainfreeze/ea12bc59e18e774e3ee04d8dd38217aa to your computer and use it in GitHub Desktop.
Save frainfreeze/ea12bc59e18e774e3ee04d8dd38217aa to your computer and use it in GitHub Desktop.

Deleting your complete discord dm history

This was tested only on Debian 9. You need python3 and curl in your path.

Process is relativly straightforward. Change the user, chan, and limit in the script bellow. Open discord in Firefox, open network tools, refresh page and find following request Right click on it and copy as curl, paste into get_msg without first part slightly changed that is alredy there. Now delete one of your messages and do same for delete request in return os.system...

Run the script and wait.

import os, json

user = '<your username>' #just username, without #tag
chan = <number after /@me/>
limit = 50 # how many messages to fetch

def get_msg_id(chan):
    get_msg = '''curl -s 'https://discordapp.com/api/v6/channels/{0}/messages?limit={1}' -H ... -H 'TE: Trailers' '''.format(chan, limit)
    output = os.popen(get_msg).read()
    j = json.loads(output)
    for i in range(0,limit):
        print(j[i]['id'], " | ", j[i]['author']['username'])
        if j[i]['author']['username'] == user:
            return j[i]['id'] 
        else:
            continue

def del_msg(msg_id):
    print("Got id:", msg_id)
    curl = '''curl 'https://discord.com/api/v6/channels/{0}/messages/{1}' -X DELETE -H ... -H 'TE: Trailers' '''.format(chan, msg_id)
    return os.system(curl)

while True:
    del_msg(get_msg_id(chan))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment