From 237a99d9c9e9b8f1a48f1cf361c3012002d3f31b Mon Sep 17 00:00:00 2001 From: Unstable Kitsune Date: Wed, 24 Sep 2025 00:45:17 -0400 Subject: [PATCH] Add datamanager --- datamanager.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 datamanager.md diff --git a/datamanager.md b/datamanager.md new file mode 100644 index 0000000..5aff031 --- /dev/null +++ b/datamanager.md @@ -0,0 +1,51 @@ +# DataManager Cog + +The DataManager cog is a crucial background utility designed for the long-term health and maintenance of the bot suite's database. It automatically purges old data from other cogs based on administrator-defined retention policies, preventing database bloat and ensuring continued performance. + +--- + +## 1. Features + +- **Automated Purging:** Runs a task once every 24 hours to automatically scan for and delete expired data records. +- **Multi-Cog Support:** Designed to manage data for a wide range of cogs within the UBS project, including `ModMail`, `Hiring`, `KofiShop`, `ServiceReview`, `StaffMsg`, and `Logging`. +- **Configurable Policies:** Administrators have full control to set a unique retention period (in days) for the data of each supported cog. +- **Safe & Robust:** The system safely checks if a supported cog is loaded before attempting to access its data, preventing errors. +- **Hybrid Commands:** All administrative commands work with both slash commands (`/`) and your bot's prefix (`[p]`). + +--- + +## 2. How It Works + +The DataManager is a "set it and forget it" system. Once an administrator sets a policy, the cog works silently in the background. + +For example, if an admin sets the policy for `ModMail` to 90 days, the DataManager will, once a day, check the log of all closed ModMail tickets. Any ticket that was closed more than 90 days ago will have its record permanently deleted from the bot's configuration, saving space and keeping the database clean. + +--- + +## 3. Supported Cogs & Data + +The DataManager can manage data from the following cogs: + +- `ModMail`: Deletes the record of closed threads. +- `Hiring`: Deletes the record of completed applications. +- `KofiShop`: Deletes waitlist entries. +- `ServiceReview`: Deletes submitted review messages. +- `StaffMsg`: Deletes the log of sent staff messages. +- `Logging`: Deletes the log of purgable events (like message deletion logs). + +--- + +## 4. Admin Commands + +### `/datamanagerset` + +The main command group for configuring the DataManager system. Requires `Manage Server` permissions. + +**Prefix Version:** `[p]datamanagerset` or `[p]dmset` + +- `/datamanagerset policy ` + - Sets the data purge policy for a supported cog. + - **`cog_name`**: The name of the cog to set the policy for (e.g., `ModMail`). + - **`days`**: The number of days to keep the data before it's purged. Set this to `0` to remove a policy and disable purging for that cog. +- `/datamanagerset view` + - Displays the current data purge policies for all cogs in a clean embed. \ No newline at end of file