A tool to delete Discord messages.
Project description
Delete Me Discord
Delete Me Discord is a command-line tool designed to help Discord users delete their messages across multiple channels based on time or message count criteria.
⚠️Use at Your Own Risk: Using automated tools on Discord, may violate Discord's Terms of Service and could result in account suspension or termination. Please use this tool responsibly and understand the potential risks involved.
Features
- Time-Based Deletion: Delete messages older than a specified time delta.
- Count-Based Preservation: Preserve a certain number of recent messages regardless of their age.
- Selective Channel Processing: Include or exclude specific channels, guilds, or parent categories.
- Dry Run Mode: Simulate deletions without actually removing any messages.
- Robust Logging: Track the script's actions and troubleshoot issues effectively.
- Rate Limit Handling: Automatically handles Discord API rate limits with customizable retry strategies.
Table of Contents
Installation
You can install delete-me-discord using pip. Ensure you have Python 3.6 or higher installed.
Using pip
pip install delete-me-discord
Usage
After installation, you can execute the script directly from the command line using the delete-me-discord command.
Basic Command
delete-me-discord --preserve-n 10 --preserve-last "weeks=1,days=3"
This command will delete messages older than 1 week and 3 days while preserving at least 10 messages in each channel.
Command-Line Options
-
--version: Description: Show the version number and exit. -
--include-ids: Type:strDescription: List of channel/guild/parent IDs to include. Usage:--include-ids 123456789012345678 234567890123456789 -
--exclude-ids: Type:strDescription: List of channel/guild/parent IDs to exclude. Usage:--exclude-ids 345678901234567890 456789012345678901 -
--dry-run: Type:flagDescription: Perform a dry run without deleting any messages. Useful for testing. Usage:--dry-run -
--delete-reactions: Type:flagDescription: Remove your reactions (emoji) from messages encountered. Applies even when messages are preserved or not deletable; honors--dry-run. Usage:--delete-reactions -
--log-level: Type:strChoices:DEBUG,INFO,WARNING,ERROR,CRITICALDescription: Set the logging level. Default isINFO. Usage:--log-level DEBUG -
--max-retries: Type:intDescription: Maximum number of retries for API requests in case of rate limiting. Default is5. Usage:--max-retries 10 -
--retry-time-buffer: Type:floatorfloat floatDescription: Additional time (in seconds) to wait after rate limit responses. Provide one value or two values for randomness. Default is[25, 35]. Usage:- Single value:
--retry-time-buffer 30 - Range:
--retry-time-buffer 25 35
- Single value:
-
--fetch-sleep-time: Type:floatorfloat floatDescription: Sleep time (in seconds) between message fetch requests. Provide one value or two values for randomness. Default is[0.2, 0.4]. Usage:- Single value:
--fetch-sleep-time 0.3 - Range:
--fetch-sleep-time 0.2 0.4
- Single value:
-
--delete-sleep-time: Type:floatorfloat floatDescription: Sleep time (in seconds) between message deletion attempts. Provide one value or two values for randomness. Default is[1.5, 2]. Usage:- Single value:
--delete-sleep-time 1.75 - Range:
--delete-sleep-time 1.5 2
- Single value:
-
--preserve-n: Type:intDescription: Number of recent messages to preserve in each channel regardless of--preserve-last. Default is12. Usage:--preserve-n 15 -
--preserve-last: Type:strDescription: Preserves recent messages (and reactions) within the last given delta time (e.g.,"weeks=2,days=3") regardless of--preserve-n. Default isweeks=2. Usage:--preserve-last "weeks=1,days=3" -
--fetch-max-age: Type:strDescription: Only fetch messages newer than the given time delta from now (e.g.,"weeks=1,days=2"). Speeds up recurring purges by skipping older history. If you have never purged a channel before, older messages will remain untouched. Default is no max age. Usage:--fetch-max-age "weeks=1" -
--max-messages: Type:intDescription: Maximum number of messages to fetch per channel. Defaults to no limit. Usage:--max-messages 5000
Examples
1. Delete Messages Older Than 2 Weeks and Preserve at least Last 10 Messages
delete-me-discord --preserve-n 10 --preserve-last "weeks=2"
2. Perform a Dry Run to See Which Messages Would Be Deleted
delete-me-discord --dry-run
3. Delete Messages in Specific Channels Only
delete-me-discord --include-ids 123456789012345678 234567890123456789 --preserve-last "weeks=1"
4. Exclude Specific Guilds from Deletion
delete-me-discord --exclude-ids 345678901234567890 --preserve-n 5
5. Increase Retry Attempts and Adjust Rate Limit Buffer
delete-me-discord --max-retries 10 --retry-time-buffer 30 40 --preserve-n 20
6. Speed up recurring purges by skipping older history
delete-me-discord --fetch-max-age "weeks=2" --max-messages 5000 --preserve-last "weeks=1"
Configuration
Before using delete-me-discord, you need to set up your Discord credentials by defining the following environment variables:
DISCORD_TOKEN: Your Discord authorization token. See this guide to obtain your token.DISCORD_USER_ID(optional): Your Discord user ID. This ID is used to target messages authored by you. If not provided, the tool will resolve it automatically using your token. You can obtain it by enabling Developer Mode in Discord and right-clicking your username to copy the ID.
Security Note: Never share your authorization token. Sharing it will allow others to access your account and perform actions on your behalf.
Contributing
Contributions are welcome! If you'd like to improve delete-me-discord, please follow these steps:
-
Fork the Repository: Click the "Fork" button on the repository page to create your own fork.
-
Clone Your Fork:
git clone https://github.com/janthmueller/delete-me-discord.git cd delete-me-discord
-
Create a New Branch:
git checkout -b feature/YourFeatureName
-
Make Your Changes: Implement your feature or fix bugs.
-
Commit Your Changes:
git commit -m "Add feature: YourFeatureName"
-
Push to Your Fork:
git push origin feature/YourFeatureName
-
Open a Pull Request: Navigate to the original repository and click "New Pull Request."
Reporting Issues
If you encounter any bugs or have suggestions for improvements, please open an issue in the Issues section of the repository.
License
This project is licensed under the MIT License. You are free to use, modify, and distribute this software as per the terms of the license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file delete_me_discord-0.0.11.tar.gz.
File metadata
- Download URL: delete_me_discord-0.0.11.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65ed458390fff8d87a56bd5726c50c1e67d7bf5a6ea63143fce6d287edf7fd3f
|
|
| MD5 |
c76f80808d4c6fac01c994a0d66ddfac
|
|
| BLAKE2b-256 |
de64ed68006c3ed0e88168ffc64b324d16bcdadff4a0b4e99b0c2f1dabf3747f
|
File details
Details for the file delete_me_discord-0.0.11-py3-none-any.whl.
File metadata
- Download URL: delete_me_discord-0.0.11-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1615491bc6e6baf59c81c49fa340951d49fc7f032c78af012af37fdcbf2ca22e
|
|
| MD5 |
18b1666d9ac1a485d516cc82c93e694e
|
|
| BLAKE2b-256 |
0883b395d65643b17501ddd1db827646718994723de8ce0c5059d66188b14e26
|