[V3 Filter] Unable to filter sentences #1904
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#1904
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?
Command bugs
Command name
filter add "<sentence>"What cog is this command from?
Filter [core]
What were you expecting to happen?
Whenever the full sentence is posted within the filtered Discord server, it should be removed by the bot.
What actually happened?
Nothing. Sentences will be deleted if you remove the spaces from the trigger phrase, however.
How can we reproduce this issue?
Note: it would seem that some sentences are read whereas most are not. Multiple tests are advised
Red Version
Unfortunately, that gif isn't a demonstration of anything not working.
The filter will never impact other bots, the bot owner, mods or admins:
github.com/Cog-Creators/Red-DiscordBot@3bcf375204/redbot/cogs/filter/filter.py (L248-L251)github.com/Cog-Creators/Red-DiscordBot@3bcf375204/redbot/core/utils/mod.py (L143-L150)if you need to test filter's behavior, if you launch the bot with
--devyou can use[p]mockmsgor you can get someone else to help you test it.@mikeshardmind if you watch the gif to the end you'll note that it filters the message if I remove all of the spaces. That'd imply that it does actually filter messages from a bot owner and guild admin.
If it really isn't supposed to do that, then there might be another issue at play, possibly unrelated to this report.
Edit: I have tested this with other users and in other servers. I can confirm that even without this oddity it still happens.
Does the audit log confirm it was your bot, and are you running more than one bot on that token?
If the answer to those is "yes" and "no" respectively, something is seriously wrong here.
As far as I can tell, filtering words is not tracked in the log; even with the
--debugflag. No other bots are running with this token.I have done a number of tests on this and I can confirm without a shadow of a doubt that it will filter away my messages without a problem. Have you tested and had different results?
Well, something is seriously wrong.... I can confirm both the issue with the spacing and with the bot owner being considered for deletion.
@mikeshardmind Update: In B17, I can confirm that the bot no longer removes owner messages. The filter is still broken unfortunately.
oh wait, I know exactly why bot owner messages are being considered for deletion
bot.is_ownerreturns a bool. Hence why bot owner messages are being considered for deletion. That's actually a really easy fix though as you really just need to dropuser ==from that.The sentences issue results from the way it's added to the filter. Consider the following:
https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/cogs/filter/filter.py#L76-L87
Notice under the outermost
elsein theforloop here that no spaces are ever actually added back in when adding words in the sentence totmp.I'm gonna assign this to myself to do as both are simple fixes
Resolved by #2065.