From 0d164adf6ac13611f1fc66825998d20d26f240ac Mon Sep 17 00:00:00 2001 From: bendiller Date: Thu, 17 Oct 2019 14:08:13 -0600 Subject: Address reviewer request --- bot/cogs/antimalware.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bot/cogs/antimalware.py b/bot/cogs/antimalware.py index 2ef61e8ad..b8c12accb 100644 --- a/bot/cogs/antimalware.py +++ b/bot/cogs/antimalware.py @@ -20,13 +20,14 @@ class AntiMalware(Cog): rejected_attachments = False detected_pyfile = False for attachment in message.attachments: - if not attachment.filename.lower().endswith(tuple(AntiMalwareConfig.whitelist)): - rejected_attachments = True if attachment.filename.lower().endswith('.py'): detected_pyfile = True break # Other detections irrelevant because we prioritize the .py message. + if not attachment.filename.lower().endswith(tuple(AntiMalwareConfig.whitelist)): + rejected_attachments = True + break - if rejected_attachments: + if detected_pyfile or rejected_attachments: # Send a message to the user indicating the problem (with special treatment for .py) author = message.author if detected_pyfile: -- cgit v1.2.3