diff options
| -rw-r--r-- | bot/cogs/antimalware.py | 9 | 
1 files changed, 7 insertions, 2 deletions
| diff --git a/bot/cogs/antimalware.py b/bot/cogs/antimalware.py index 28e3e5d96..957c458c0 100644 --- a/bot/cogs/antimalware.py +++ b/bot/cogs/antimalware.py @@ -4,7 +4,7 @@ from discord import Embed, Message, NotFound  from discord.ext.commands import Cog  from bot.bot import Bot -from bot.constants import AntiMalware as AntiMalwareConfig, Channels, URLs +from bot.constants import AntiMalware as AntiMalwareConfig, Channels, STAFF_ROLES, URLs  log = logging.getLogger(__name__) @@ -18,7 +18,12 @@ class AntiMalware(Cog):      @Cog.listener()      async def on_message(self, message: Message) -> None:          """Identify messages with prohibited attachments.""" -        if not message.attachments: +        # Return when message don't have attachment and don't moderate DMs +        if not message.attachments or not message.guild: +            return + +        # Check if user is staff, if is, return +        if hasattr(message.author, "roles") and any(role.id in STAFF_ROLES for role in message.author.roles):              return          embed = Embed() | 
