AutoPurge is a Discord bot 🤖 designed to automatically delete messages in one or multiple text channels after a predefined time ⏳. This helps in maintaining cleanliness and organization within your Discord server, as well as ensuring unwanted or outdated messages are removed automatically.
- Automatic deletion of messages in selected text channels 📜
- Configurable time intervals for message deletion per channel ⏲️
- Configurable interval for checking messages ⏲️
- Easy setup using environment variables or a configuration file 🛠️
- Progress bar displaying the time remaining until the next message check 🔄⏳
- Java 17 or higher
- Clone this repository or download it as a zip file and extract it to your desired location 📂
- Open a terminal/command prompt and navigate to the repository's root directory 🖥️
- If necessary, grant execute permissions for the
gradlewscript by running the following command:
chmod +x gradlew
- Run the following command to compile the Kotlin project and generate a JAR file:
./gradlew build
- Once the build is complete, the generated JAR file can be found in
build/libsdirectory 📦
For optimal security, it is recommended to use environment variables for configuration. However, you can also use a config.properties file if you prefer.
Provide the following environment variables for the bot to function properly:
BOT_TOKEN: The Discord bot token 🎫 (Obtain this from the Discord Developer Portal)PURGE_CHANNELS: A comma-separated list of Text Channel IDs and their corresponding maximum message age (in hours) that the bot will monitor for message deletion 📝 (For example,1234567890(12),0987654321(24)for two channels with different maximum message ages)INTERVAL_MINUTES: (Optional) The interval (in minutes) between each message check ⏲️ (For example,60for checking messages every hour). Default value is 60 minutes.
- Locate the
config.properties.examplefile in the root directory of the project. - Edit the
config.properties.examplefile and fill in the required information: - Save the edited file and rename it to
config.properties. - Move the
config.propertiesfile to thebuild/libs/directory.
To start the bot, use the following command:
java -jar build/libs/AutoPurge.jar
The bot should now be running and will automatically delete messages in the specified text channels after the configured time interval, while displaying a progress bar for the time remaining until the next check 🎉