This Python script deletes your own messages from Discord DMs and guild channels using the Discord API.
- Fetches your Discord user ID automatically
- Scans all DM channels
- Scans all servers (guilds) you are in
- Finds messages sent by your account
- Deletes those messages
- Handles rate limits automatically
- Uses pagination to process large message histories
- Python 3.8+
requestslibrary
Install dependencies:
pip install requestsOpen the script and replace:
USER_TOKEN = 'xxxx'with your Discord user token.
Run the script:
python script.pyThe script will:
- Fetch your user ID
- Scan all DM channels and delete your messages
- Scan all guilds and channels and delete your messages
- Print progress in the console
The script uses these Discord API endpoints:
/users/@meto get your user ID/users/@me/channelsto get DM channels/users/@me/guildsto get guilds/guilds/{guild_id}/channelsto get channels/channels/{channel_id}/messagesto fetch messages/channels/{channel_id}/messages/{message_id}to delete messages
It filters messages by author ID so only your messages are deleted.
Discord enforces rate limits. This script:
- Waits between requests
- Detects HTTP 429 responses
- Retries automatically after the required delay
Using a user token with scripts may violate Discord Terms of Service and can result in account suspension or termination. Use at your own risk.
Never share your user token. Anyone with your token has full access to your account.
This script is provided for educational purposes only. You are responsible for how you use it.
MIT License