[Cleanup] Delete important amount of attachment #4813
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#4813
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What component of Red (cog, command, API) would you like to see improvements on?
Cleanup, the command
cleanup spam.Describe the enhancement you're suggesting.
Listen kids, it's the story of a nice server that got raided yesterday the 13 February 2021. This story happened on a nice place to visit and very calm, a Discord server.
But problems started when the bad guys came in my server and sent those horrible things.
His image... I am still shocked... He sent his... his...
His weird shit!
My members was troubled. I was troubled, everyone did their best to stay calm and handle the situation. When I came, I was extremely shocked: Over 20 messages no contents with only attachments. His image. Only... his terrible image, wrote forever in my head. I'll never forget the content of it. Of those images.
We handled the situation, time has come: We had to delete the shit.
I had the super idea to use Red-DiscordBot with the powerful cleanup cog, one of the most powerful cog to delete bad messages!
I used the command that was the most suggestive to the situation,
[p]cleanup spam. The command was deleted, everyone felt like everything come back to normal, but then, I scrolled to the top and... HORROR! Images were still here! My phone dropped, my hands were shaking, my eyes were fixed on the floor. My mind was starting to ask ton of questions;"What happened?"
"Is Red bad? Must I change?"
"Did we got Rick rolled?"
"Am I unable to handle this by myself?"
"What are we gonna do?"
I took my phone back, then deleted all messages correctly.
Finally, everyone was fine, emergency was removed and everyone talked like before, like nothing happened.
The story says the main hero wrote this story and made his best to ask to solve this problem.
"The problem is that
cleanup spamdoes not delete spammy messages that only have an attachment, but no content, but that would be super useful for this kind of use case!"The End.
The messages with attachments are not included in deletion on purpose as there's no good way to figure out if the messages are equivalent in such a case.
This can be reconsidered, but we would need a more specific proposal as I'm not sure how it is supposed to be done so that we remove message with attachments that are spam, rather than actually meaningful messages.
I think message with no content but only attachment can be considered as spam at the moment there is more than 10 (Maybe 5, probably) times only attachment, which would let more safety for non spam messages.
That's my only idea, so far, I honestly have no idea on how else the command could check for spam.
A bool could be added to the command params to include attachments, however normally cleanup uses a bool to delete pinned, so I don't know how good of an idea that would be.
If all the messages were from the same user, I would recommend
[p]cleanup user, otherwise you can use[p]cleanup between.I don't think this is the way to go, I personally wouldn't like if the command assumed that some messages in sequence were duplicates simply because they have attachments, when in reality they might be different from each other.
Also my suggestion, other than what Flame442 said, is to use the days parameter of the ban / massban command, which is a way quicker (and reliable) way to instanuke gross things from your server. This command sounds like the wrong tool for the job for what you were trying to do.
One way to do it would be to compare the raw bytes of the attachments (i.e. compare the return value of
Attachment.read) but I could see that leading to false negatives somehowAt that point with how easy it would be to circumvent, it would be a better idea to just use one of the other
cleanupcommands. I personally don't thinkcleanup spamshould be modified to include images, as there are other commands that can do effectively the same job already.The command was renamed from
cleanup spamtocleanup duplicatesto be less vague. I don't think that comparing the full contents of attachments is that good of an idea so I guess we could just add a note saying that messages containing attachments are ignored when checking for duplicate messages.