DiscordAutoDelete is a simple yet useful Discord bot designed to manage and automate message deletion tasks in Discord servers. It offers simple but powerful control over which messages are deleted.
The bot uses a rolling log system. When the channel exceeds a set message limit the oldest message that exceeded the limit will be deleted. Messages are not purged in bulk to minimize disruption. You can customize it to exclude pinned messages or bot embeds from being deleted.
- Automatic Message Deletion: Configure channels to automatically delete messages exceeding a specified limit.
- Customizable Rules: Control whether pinned messages or bot embeds are deleted.
- Management Roles: Restrict bot management commands to designated roles.
- Statistics Tracking: View statistics for deleted messages across channels.
- Restart and Configuration Persistence: Seamlessly restart the bot without losing configuration.
- Python 3.8+
- Discord Bot Token
- Required Python packages (install with
pip install -r requirements.txt):discord.pypython-dotenvasyncio
-
Clone the Repository:
git clone https://github.com/dvingerh/DiscordAutoDelete.git cd DiscordAutoDelete -
Install Dependencies:
pip install -r requirements.txt
-
Configure Environment Variables: Create a
.envfile with the following:DISCORD_TOKEN=your_discord_bot_token BOT_STATUS=AutoDelete Bot -
Run the Bot:
python autodelete.py
-
/autodelete addAdd a new auto-delete task for a specific channel.- Parameters:
channel: Target channel.limit: Maximum number of messages allowed.pins: Delete pinned messages (True/False).embeds: Delete bot embeds (True/False).enabled: Enable or disable the task (True/False).
- Parameters:
-
/autodelete removeRemove an auto-delete task from a channel. -
/autodelete listList all existing tasks with their configurations. -
/autodelete editEdit an existing task. -
/autodelete statsView statistics of deleted messages across channels.
-
/autodelete setupAssign roles authorized to manage the bot. -
/autodelete restartRestart the bot with configuration persistence. -
/autodelete disableBulk disable all tasks in the current server. -
/autodelete enableBulk enable all tasks in the current server. -
/autodelete purgePurge all tasks for the server (requires confirmation). -
/autodelete helpView a list of all commands.
autodelete.py: Main bot script.autodelete_config.json: Persistent configuration file for tasks and statistics..env: Environment variable configuration file.
- Ensure the bot has the following Discord permissions:
- Manage Messages
- View Channels
- Send Messages
- Read Message History
This project is open-source and available under the MIT License.