bot icon indicating copy to clipboard operation
bot copied to clipboard

fix: don't include replied mentions in mention filter

Open onerandomusername opened this issue 3 years ago • 5 comments

closes #2015

  • no longer counts mention replies
  • no longer counts self-mentions

onerandomusername avatar Dec 17 '21 16:12 onerandomusername

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 avatar May 29 '22 14:05 ichard26

@ichard26 if you're still interested in this feel free to assign yourself, otherwise this can be marked as up for grabs.

wookie184 avatar Aug 04 '22 18:08 wookie184

No, not really anymore. I'll put it up for grabs.

ichard26 avatar Aug 05 '22 17:08 ichard26

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:

TizzySaurus avatar Aug 06 '22 21:08 TizzySaurus

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.

TizzySaurus avatar Aug 09 '22 18:08 TizzySaurus

This PR is now ready for review again 😄

TizzySaurus avatar Aug 14 '22 16:08 TizzySaurus

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:

TizzySaurus avatar Aug 17 '22 20:08 TizzySaurus