TJ-Bot icon indicating copy to clipboard operation
TJ-Bot copied to clipboard

Feat/purge messages upto 24 hrs in current channel

Open ankitsmt211 opened this issue 2 years ago • 1 comments

For earlier context related to PR, #945

resolves #912

Workflow

  1. Message Sent: A user sends a message in a Discord channel.
  2. Log Message Metadata: The Message Listener detects the new message and logs its metadata into the Database Table.
  3. Periodic Cleanup: The Cleanup Routine periodically checks the database for messages older than 24 hours and deletes them.
  4. Database Overload Prevention: The Emergency Brake activates if the database approaches its record limit, preventing spamming and overload.
  5. Database Size Management: The Record Management Subroutine deletes the oldest records to make space for new entries when nearing the database limit for this feature(~7.5k records).

Includes

  • Database Table: Tracks message metadata.
  • Cleanup Routine: Removes records older than 24 hours.
  • Message Listener: Logs new messages into the database.
  • New Package: Dedicated to the feature.
  • New Command: /purge-in-channel.
  • Issue Resolution: Resolves #912.

Additions

  • Emergency Brake: Prevents spamming DB after cetain limit.
  • Record Management Subroutine: Deletes oldest records to free up DB limit for this feature once triggered.

Command Interface

image

when there's no records: image

if there's any records within selected duration: image

Note: Duration is optional, if skipped it defaults to last hour.

ankitsmt211 avatar Dec 10 '23 18:12 ankitsmt211

converting this PR to draft, feel like it needs a bit of refactoring considering moderation usecase per channel basis might not be suited anymore.

ankitsmt211 avatar May 13 '24 02:05 ankitsmt211

It appears that this has been inactive for some time, and since you also mentioned that we would not necessarily need something like this as a feature in the server, I will close the PR for the time being. Feel free to reopen this at any time if you wish to continue work on it.

christolis avatar Jun 29 '25 08:06 christolis