Welcome to the GravBits Discord bot repository! GravBits is designed to automate the process of monitoring and deleting old messages in specified channels. It supports PostgreSQL for data persistence and is equipped with several useful commands to manage message deletion intervals and aging.
Note: Only users with the
bot_cmdrole can access the bot's commands.
- 🔐 Role-Based Permissions: Only users with the
bot_cmdrole can use the bot's commands, ensuring secure access. - 🕒 Custom Intervals: Set custom scan intervals to check and delete messages older than a specified age.
- 📊 Database Integration: Uses PostgreSQL to store guild and channel-specific settings.
- 🧹 Bulk Message Deletion: Easily delete messages in bulk based on user-specified criteria.
- 🔄 Automated Scanning: Periodically scans channels and deletes messages older than the configured age.
To set up GravBits on your server, follow these steps:
-
Clone the repository:
git clone [email protected]:ScienHAC/Discord_Bot.git
-
Navigate to the bot directory:
cd Discord_Bot -
Install dependencies:
npm install
-
Set up environment variables:
Create a
.envfile in the root directory with your credentials:DISCORD_TOKEN=your_discord_token Client_Id=your_discord_client_id PGHOST=your_postgres_host PGDATABASE=your_postgres_database PGUSER=your_postgres_user PGPASSWORD=your_postgres_password PGPORT=your_postgres_port
-
Start the bot:
npm start
GravBits offers several commands to help manage and automate message deletion. Here’s a quick guide:
| Command | Description | Example |
|---|---|---|
/add-gravbits |
Add the current channel for automatic message deletion. | /add-gravbits |
/remove-gravbits |
Remove the current channel from automatic deletion. | /remove-gravbits |
/check-gravbits |
Set the interval (in hours) for scanning this channel. | /check-gravbits interval:3 |
/deltime-gravbits |
Set the delete age (in hours) for messages. | /deltime-gravbits delete_age:48 |
/delete-gravbits |
Delete a specific number of messages from the channel. | /delete-gravbits count:50 |
/scan |
Display the list of channels currently being monitored. | /scan |
Note: Make sure the user executing the commands has the bot_cmd role.
GravBits uses PostgreSQL to store and manage channel-specific settings such as scan intervals and delete ages. Upon startup, the bot automatically creates the necessary tables if they don’t already exist.
- Table Name:
gravbits_channelsguild_id: The ID of the Discord guild.channel_id: The ID of the monitored channel.interval: How often the bot scans the channel (in hours).delete_age: The age of messages to be deleted (in hours).
GravBits automatically scans channels at the specified interval and deletes messages older than the delete_age. This process is managed using the following:
- Scanning and Deletion: Channels added via
/add-gravbitsare periodically scanned, and messages older than thedelete_ageare removed. - Customization: Use
/check-gravbitsto adjust scan intervals and/deltime-gravbitsto modify the age threshold for deletions. - Manual Deletion: You can also manually trigger message deletion with
/delete-gravbits.
We welcome contributions! Feel free to open issues or submit pull requests to help improve GravBits.
- Fork this repository.
- Make your changes in a new branch.
- Submit a pull request, and we’ll review it!
This project is licensed under the MIT License. See the LICENSE file for details.
If you find GravBits helpful, consider giving this repository a ⭐ to show your support!