Skip to content

Conversation

Simplyalex99
Copy link
Contributor

@Simplyalex99 Simplyalex99 commented Jul 2, 2025

Description: This pull-request resolves #15 by having a bot delete all duplicate messages except the original channel and send a warning in each channel that lasts about 30 seconds.

To reduce memory consumption, a LRU cache is used and some size restrictions. Currently, Discord has a max of 2000 characters limit per message. The worst case scenario the size of this will be ~2MB; Max size of cache is 100 * max set size 5 storing messages * 2 bytes per character * 2000 max characters from Discord = 2MB. Though this cache last for 30 seconds before clearing again.

Realistically, the average message containing 500 characters would be 500 × 1 KB = ~500 KB for the cache memory consumption.

Also, a test file was created to test the feature and the caching. A dependency, shoehorn, was installed to help with the tests' mockup.

Copy link

what-the-diff bot commented Jul 2, 2025

PR Summary

  • New Dependency Added

    • A new software package called @total-typescript/shoehorn has been included, introducing more tools that enhance the overall functionality of our project.
  • Duplicate Scanner Functionality

    • A new feature known as the Duplicate Scanner has been created. This helps by finding and managing any duplicate messages that a user might send.
    • This scanner comes built-in with a Least Recently Used (LRU) cache, meaning it efficiently keeps hold of a set number of the most recent messages per user.
    • Now, when a user sends a duplicate message, they will be promptly warned, and the message will be deleted automatically.
  • Addition of Unit Tests

    • Tests for the duplicate message scanner functionality have been created to ensure everything works as it should.
    • These tests verify that duplicate messages are recognized, and the cache is operating as planned.
  • Program Index-Updating

    • The Duplicate Scanner has now been integrated into the main program, enabling it to work in specified channels and contribute to the bot's overall functionality.

@Simplyalex99 Simplyalex99 requested a review from kristersd July 9, 2025 10:27
@Simplyalex99 Simplyalex99 merged commit 16b126d into reactiflux:main Jul 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dedupe cross-posts
2 participants