Improving the filter #2689
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#2689
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?
Feature request
Derived from here: https://github.com/Cog-Creators/Red-DiscordBot/issues/2687
Select the type of feature you are requesting:
Describe your requested feature
So, regarding the recent Filter change, I believe that adding a command that would allow either inclusive phase / string filtering, or a possibility to add an own regex filter pattern (since the filtering is being done with re anyway), would massively extend the filtering possibilities to encompass this behavior.
The suggested command would be
[p]filter addi(add inclusive) or[p]filter addr(add regex).The reason behind this addition is that filtered / not allowed words often come in different formats and forms. As an example, let's consider an end user disallowing usage of the word
hackto discourage talking about this topic on their server. To do this effectively with the current implementation, they would also have to addhacks,hackingandhackedas the filtered words, requiring 4 commands in total. Maintaining a filter like this becomes a huge hassle as time goes on and more words and their different forms are added, also requiring more computational power during checking. This could be easily solved by allowing the end user to specifyhackas inclusive, filtering messages with it in every possible case.Because inclusive filtering may also lead to false-positives (like filtering
tardinmustard), I'd lean more towards implementing adding regex patterns. Filteringhackand it's different forms would be as easy as doing:[p]filter addr hack(?:s|ed|ing)?Adding additional commands to allow searching without the word boundaries would be reasonably accommodated.
We will not be adding user provided regex filter support to filter without a lot of consideration as to how to handle it safely. It is unlikely to be added for reasons below.
Python's regex engine is susceptible to ReDoS attacks, and this would be giving control of both the regex and input to any guild owner on a public instance, allowing any public instance with filter loaded to be crashed trivially.
The only sane way without a significant performance loss would be to use a different regex engine (re2), but this introduces a C++ lib dependency.
There are 3rd party cogs which take extra steps to handle regex, but each comes with downsides not suitable for the core cog.
I refering to this request and want to add some features, which are missing in the filter system by now.
Concider this
Offene Diskussion bzw. Feature-Wunsch mit geringem Nutzen im Verhältnis zum Aufwand (oder Nischenfall), der seit Langem ohne Ergebnis offen ist. Ich schließe das Issue; bei konkretem Bedarf kann es gern wieder geöffnet werden.
Generated by Claude Code