Antimalware cog#528
Conversation
There was a problem hiding this comment.
Hey!
Thank you for your time! I did a few remarks on the form of your code, but I'm a small contributor, so you can wait for a more in-depth review.
Note: I did not see where you delete the message in your code. Is it already handled by another cog?
|
Good feedback @kraktus, thank you! As for the message deletion, that begins on line 39, directly above the |
Yep I did not see it because I reviewed the first commit :) |
MarkKoz
left a comment
There was a problem hiding this comment.
Tested this locally and it works, even with multiple attachments (sent from phone). One concern is that moderators are not exempt from this functionality but I'll let them have the say on whether they should be.
GhostofGoes
left a comment
There was a problem hiding this comment.
I don't see a reason mods would need to be exempt from the whitelist. If we decide otherwise in the future, it should be fairly straightforward to add a check for staff and apply a separate or additional whitelist.
Howdy! This PR is intended to address issue #471 (auto-deleting messages with potentially malicious file attachments). After discussing with @lemonsaurus, it became clear that a new Cog would make for a cleaner implementation, instead of a new rule within the
AntiSpamCog. I'll be happy to elaborate on those reasons if anyone would like further details.Here's about the simplest implementation I could conceive, using the suggestions made in the issue's notes. Some points for further discussion:
-
AntiSpam.on_message()begins with a handful of early-out conditions. I don't quite understand the purpose of some of those, so I did not include any, pending further review by staff.-
AntiSpamcallsModLog.ignore()before deleting messages - I wasn't clear on why, so I did not do the same.I'll be happy to make any requested changes. Thanks!