We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Filters should not apply to staff members
Currently, we have certain channels whitelisted for certain filters and some filters apply to all members, even Owners cannot post filetypes that aren't on the whitelist!

Please change this so that absolutely all filters will ignore all staff members. It is not necessary to whitelist staff channels or to keep any other kind of exceptions to the filters once this very simple exception has been added, so please clean up any such exceptions while you're at it.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `bot/cogs/antimalware.py`
Content:
```
1 import logging
2 
3 from discord import Embed, Message, NotFound
4 from discord.ext.commands import Cog
5 
6 from bot.bot import Bot
7 from bot.constants import AntiMalware as AntiMalwareConfig, Channels, URLs
8 
9 log = logging.getLogger(__name__)
10 
11 
12 class AntiMalware(Cog):
13     """Delete messages which contain attachments with non-whitelisted file extensions."""
14 
15     def __init__(self, bot: Bot):
16         self.bot = bot
17 
18     @Cog.listener()
19     async def on_message(self, message: Message) -> None:
20         """Identify messages with prohibited attachments."""
21         if not message.attachments:
22             return
23 
24         embed = Embed()
25         for attachment in message.attachments:
26             filename = attachment.filename.lower()
27             if filename.endswith('.py'):
28                 embed.description = (
29                     f"It looks like you tried to attach a Python file - please "
30                     f"use a code-pasting service such as {URLs.site_schema}{URLs.site_paste}"
31                 )
32                 break  # Other detections irrelevant because we prioritize the .py message.
33             if not filename.endswith(tuple(AntiMalwareConfig.whitelist)):
34                 whitelisted_types = ', '.join(AntiMalwareConfig.whitelist)
35                 meta_channel = self.bot.get_channel(Channels.meta)
36                 embed.description = (
37                     f"It looks like you tried to attach a file type that we "
38                     f"do not allow. We currently allow the following file "
39                     f"types: **{whitelisted_types}**. \n\n Feel free to ask "
40                     f"in {meta_channel.mention} if you think this is a mistake."
41                 )
42         if embed.description:
43             await message.channel.send(f"Hey {message.author.mention}!", embed=embed)
44 
45             # Delete the offending message:
46             try:
47                 await message.delete()
48             except NotFound:
49                 log.info(f"Tried to delete message `{message.id}`, but message could not be found.")
50 
51 
52 def setup(bot: Bot) -> None:
53     """Load the AntiMalware cog."""
54     bot.add_cog(AntiMalware(bot))
55
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/bot/cogs/antimalware.py b/bot/cogs/antimalware.py
--- a/bot/cogs/antimalware.py
+++ b/bot/cogs/antimalware.py
@@ -4,7 +4,7 @@
 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,13 @@
     @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
+        # Since we only care that roles exist to iterate over, check for the attr rather than a User/Member instance
+        if hasattr(message.author, "roles") and any(role.id in STAFF_ROLES for role in message.author.roles):
             return
 
         embed = Embed()

{"golden_diff": "diff --git a/bot/cogs/antimalware.py b/bot/cogs/antimalware.py\n--- a/bot/cogs/antimalware.py\n+++ b/bot/cogs/antimalware.py\n@@ -4,7 +4,7 @@\n from discord.ext.commands import Cog\n \n from bot.bot import Bot\n-from bot.constants import AntiMalware as AntiMalwareConfig, Channels, URLs\n+from bot.constants import AntiMalware as AntiMalwareConfig, Channels, STAFF_ROLES, URLs\n \n log = logging.getLogger(__name__)\n \n@@ -18,7 +18,13 @@\n     @Cog.listener()\n     async def on_message(self, message: Message) -> None:\n         \"\"\"Identify messages with prohibited attachments.\"\"\"\n-        if not message.attachments:\n+        # Return when message don't have attachment and don't moderate DMs\n+        if not message.attachments or not message.guild:\n+            return\n+\n+        # Check if user is staff, if is, return\n+        # Since we only care that roles exist to iterate over, check for the attr rather than a User/Member instance\n+        if hasattr(message.author, \"roles\") and any(role.id in STAFF_ROLES for role in message.author.roles):\n             return\n \n         embed = Embed()\n", "issue": "Filters should not apply to staff members\nCurrently, we have certain channels whitelisted for certain filters and some filters apply to all members, even Owners cannot post filetypes that aren't on the whitelist!\r\n\r\nPlease change this so that absolutely all filters will ignore all staff members. It is not necessary to whitelist staff channels or to keep any other kind of exceptions to the filters once this very simple exception has been added, so please clean up any such exceptions while you're at it.\n", "before_files": [{"content": "import logging\n\nfrom discord import Embed, Message, NotFound\nfrom discord.ext.commands import Cog\n\nfrom bot.bot import Bot\nfrom bot.constants import AntiMalware as AntiMalwareConfig, Channels, URLs\n\nlog = logging.getLogger(__name__)\n\n\nclass AntiMalware(Cog):\n    \"\"\"Delete messages which contain attachments with non-whitelisted file extensions.\"\"\"\n\n    def __init__(self, bot: Bot):\n        self.bot = bot\n\n    @Cog.listener()\n    async def on_message(self, message: Message) -> None:\n        \"\"\"Identify messages with prohibited attachments.\"\"\"\n        if not message.attachments:\n            return\n\n        embed = Embed()\n        for attachment in message.attachments:\n            filename = attachment.filename.lower()\n            if filename.endswith('.py'):\n                embed.description = (\n                    f\"It looks like you tried to attach a Python file - please \"\n                    f\"use a code-pasting service such as {URLs.site_schema}{URLs.site_paste}\"\n                )\n                break  # Other detections irrelevant because we prioritize the .py message.\n            if not filename.endswith(tuple(AntiMalwareConfig.whitelist)):\n                whitelisted_types = ', '.join(AntiMalwareConfig.whitelist)\n                meta_channel = self.bot.get_channel(Channels.meta)\n                embed.description = (\n                    f\"It looks like you tried to attach a file type that we \"\n                    f\"do not allow. We currently allow the following file \"\n                    f\"types: **{whitelisted_types}**. \\n\\n Feel free to ask \"\n                    f\"in {meta_channel.mention} if you think this is a mistake.\"\n                )\n        if embed.description:\n            await message.channel.send(f\"Hey {message.author.mention}!\", embed=embed)\n\n            # Delete the offending message:\n            try:\n                await message.delete()\n            except NotFound:\n                log.info(f\"Tried to delete message `{message.id}`, but message could not be found.\")\n\n\ndef setup(bot: Bot) -> None:\n    \"\"\"Load the AntiMalware cog.\"\"\"\n    bot.add_cog(AntiMalware(bot))\n", "path": "bot/cogs/antimalware.py"}], "after_files": [{"content": "import logging\n\nfrom discord import Embed, Message, NotFound\nfrom discord.ext.commands import Cog\n\nfrom bot.bot import Bot\nfrom bot.constants import AntiMalware as AntiMalwareConfig, Channels, STAFF_ROLES, URLs\n\nlog = logging.getLogger(__name__)\n\n\nclass AntiMalware(Cog):\n    \"\"\"Delete messages which contain attachments with non-whitelisted file extensions.\"\"\"\n\n    def __init__(self, bot: Bot):\n        self.bot = bot\n\n    @Cog.listener()\n    async def on_message(self, message: Message) -> None:\n        \"\"\"Identify messages with prohibited attachments.\"\"\"\n        # Return when message don't have attachment and don't moderate DMs\n        if not message.attachments or not message.guild:\n            return\n\n        # Check if user is staff, if is, return\n        # Since we only care that roles exist to iterate over, check for the attr rather than a User/Member instance\n        if hasattr(message.author, \"roles\") and any(role.id in STAFF_ROLES for role in message.author.roles):\n            return\n\n        embed = Embed()\n        for attachment in message.attachments:\n            filename = attachment.filename.lower()\n            if filename.endswith('.py'):\n                embed.description = (\n                    f\"It looks like you tried to attach a Python file - please \"\n                    f\"use a code-pasting service such as {URLs.site_schema}{URLs.site_paste}\"\n                )\n                break  # Other detections irrelevant because we prioritize the .py message.\n            if not filename.endswith(tuple(AntiMalwareConfig.whitelist)):\n                whitelisted_types = ', '.join(AntiMalwareConfig.whitelist)\n                meta_channel = self.bot.get_channel(Channels.meta)\n                embed.description = (\n                    f\"It looks like you tried to attach a file type that we \"\n                    f\"do not allow. We currently allow the following file \"\n                    f\"types: **{whitelisted_types}**. \\n\\n Feel free to ask \"\n                    f\"in {meta_channel.mention} if you think this is a mistake.\"\n                )\n        if embed.description:\n            await message.channel.send(f\"Hey {message.author.mention}!\", embed=embed)\n\n            # Delete the offending message:\n            try:\n                await message.delete()\n            except NotFound:\n                log.info(f\"Tried to delete message `{message.id}`, but message could not be found.\")\n\n\ndef setup(bot: Bot) -> None:\n    \"\"\"Load the AntiMalware cog.\"\"\"\n    bot.add_cog(AntiMalware(bot))\n", "path": "bot/cogs/antimalware.py"}]}