DISCLAIMER
The author of this script takes ABSOLUTELY NO RESPONSIBILITY for your own actions or usage of the script, and if you do choose to use this script, you do so ENTIRELY AT YOUR OWN RISK.
This script uses Discord's undocumented User API, which has no official public documentation and is not intended to be used by anyone other than Discord's own internal developers. It is a self-botting script, meaning that it automates actions acting as though the user themselves were performing them manually.
Self-botting is explicitly forbidden by the Discord Trust & Safety Team and can result in an account termination if found. Therefore, it's not unlikely that using this script may incur a ban on your account. Discord's explicit condemnation of self-botting can be found here.
About
purge_discord.py
is a Discord self-botting Python script that allows the user to programmatically mass-delete all of the messages that they sent in a given Discord server, including DMs & group chats, via the Discord User API. It is primarily designed to be ran from a command-line, with the URL of a channel being passed to the script as arguments.
The purpose of the script is to enhance the user's control over their private information on Discord. Discord is not a social media platform with strong privacy practices, and I firmly believe that an individual should have the right to remove their data from any given platform quickly & easily at will. At present, there is no way to delete all of your messages from Discord. Not even deleting your account will remove your messages from the platform, and they will still be visible permanently. Deleting your account is in this sense worse for your privacy, as you lose control over your messages; Once you delete your account, you will permanently lose the ability to delete any of your messages, meaning that any information you revealed in those messages is now permanently public information.
The URL feature was added to make it easy for me to embed the functionality of this script into my browser of choice, qutebrowser via a keybinding, as I use Discord almost exclusively from my browser. When I press the keybinding ,p
, qutebrowser runs the script, passing the URL of the webpage that I'm currently as an argument.
Usage
Pre-requisites
python-3.7
or later- Python libraries:
asyncio
aiohttp
dotenv
You will also need to know your Discord token. The steps to find this can be found here. Note that your Discord token gives anyone who has it access to your account, so ensure that you do not share your Discord token with anyone, under any circumstances.
Setup
- Clone this repository.
git clone https://github.com/0hAodha/purge_discord
- Navigate to the newly created
purge_discord
directory on your machine. - Edit the
.env
file with your text editor of choice and replace the placeholder value of theDISCORD_TOKEN
variable with your actual Discord token. It should look something like the following:
DISCORD_TOKEN=AAAAAAAAAAAAAAAAAAAAAAAAAA.BBBBBB.CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
Running the Script
To get usage information, you can run the script with no arguments. The usage information will be displayed every time that the script is called with valid number of arguments or with unknown flags.
./purge_discord.py
The output should be as follows:
usage: purge_discord.py [-h] -u CHANNEL_URL
Script to delete all a user's messages in a given Discord server
options:
-h, --help show this help message and exit
-u, --channel-url CHANNEL_URL
URL of a channel in the server
The URL is the one that is shown in the address bar of your browser when you navigate to that channel in the web version of the Discord application. The URL can be passed to the script as follows:
./purge_discord.py -u https://discord.com/channels/@me/1234567890123456789