bot
bot copied to clipboard
fix: don't include replied mentions in mention filter
closes #2015
- no longer counts mention replies
- no longer counts self-mentions
Hi @onerandomusername, do you still want to work on this PR or should I put this up for grabs? I kinda want to work on this hence why I'm triaging this :p
@ichard26 if you're still interested in this feel free to assign yourself, otherwise this can be marked as up for grabs.
No, not really anymore. I'll put it up for grabs.
The logic here isn't quite correct, as this will currently subtract 1 from the total even if the reply was to a bot or themself, in which case it wasn't counted in the first place.
This has been fixed (I took over the PR) :+1:
I've just fixed the tests for this PR, but am looking to also add a new test that ensures this PR actually works (pings from replies don't count in the anti-spam rule).
This means creating a new MockReferencedMessage class which I don't have the time to look into today, but will hopefully be done over the upcoming days.
This PR is now ready for review again 😄
It would be clearer to just have a loop that does all the checks necessary before incrementing the total. The logic to get the replied to message is also quite involved, so could be moved to a separate function, possibly in
bot.utils.messages. You'd then have something more like this: ...
Yeah, I completely agree. The current logic was done by @onerandomusername and I didn't think to adjust it. I'll do this :+1: