We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add an `attachments` rule
# Abstract 

We should have an antispam rule filtering small burst of images. 

# Rationale

Currently, when a user posts 4 images in less than 10 seconds without any comment, the `duplicates` rule will trigger. While we still want to be informed when many images are posted, having the `duplicates` rule trigger doesn't make much sense. Besides, if different message content is given for each image, it will only trigger `burst` if more than 9 messages are sent in 10 seconds. 

# Specification

- [ ] Make sure that the `duplicates` filter won't be triggered by messages with images. We can safely skip empty messages with attachments.
- [ ] Create an `images` filter based on `duplicates` that will trigger when more than 3 images are posted in less than 10 seconds. It should ignore the message content. 

--- 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/rules/duplicates.py`
Content:
```
1 from typing import Dict, Iterable, List, Optional, Tuple
2 
3 from discord import Member, Message
4 
5 
6 async def apply(
7     last_message: Message, recent_messages: List[Message], config: Dict[str, int]
8 ) -> Optional[Tuple[str, Iterable[Member], Iterable[Message]]]:
9     """Detects duplicated messages sent by a single user."""
10     relevant_messages = tuple(
11         msg
12         for msg in recent_messages
13         if (
14             msg.author == last_message.author
15             and msg.content == last_message.content
16         )
17     )
18 
19     total_duplicated = len(relevant_messages)
20 
21     if total_duplicated > config['max']:
22         return (
23             f"sent {total_duplicated} duplicated messages in {config['interval']}s",
24             (last_message.author,),
25             relevant_messages
26         )
27     return None
28
```
--- 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/rules/duplicates.py b/bot/rules/duplicates.py
--- a/bot/rules/duplicates.py
+++ b/bot/rules/duplicates.py
@@ -13,6 +13,7 @@
         if (
             msg.author == last_message.author
             and msg.content == last_message.content
+            and msg.content
         )
     )

{"golden_diff": "diff --git a/bot/rules/duplicates.py b/bot/rules/duplicates.py\n--- a/bot/rules/duplicates.py\n+++ b/bot/rules/duplicates.py\n@@ -13,6 +13,7 @@\n         if (\n             msg.author == last_message.author\n             and msg.content == last_message.content\n+            and msg.content\n         )\n     )\n", "issue": "Add an `attachments` rule\n# Abstract \r\n\r\nWe should have an antispam rule filtering small burst of images. \r\n\r\n# Rationale\r\n\r\nCurrently, when a user posts 4 images in less than 10 seconds without any comment, the `duplicates` rule will trigger. While we still want to be informed when many images are posted, having the `duplicates` rule trigger doesn't make much sense. Besides, if different message content is given for each image, it will only trigger `burst` if more than 9 messages are sent in 10 seconds. \r\n\r\n# Specification\r\n\r\n- [ ] Make sure that the `duplicates` filter won't be triggered by messages with images. We can safely skip empty messages with attachments.\r\n- [ ] Create an `images` filter based on `duplicates` that will trigger when more than 3 images are posted in less than 10 seconds. It should ignore the message content. \n", "before_files": [{"content": "from typing import Dict, Iterable, List, Optional, Tuple\n\nfrom discord import Member, Message\n\n\nasync def apply(\n    last_message: Message, recent_messages: List[Message], config: Dict[str, int]\n) -> Optional[Tuple[str, Iterable[Member], Iterable[Message]]]:\n    \"\"\"Detects duplicated messages sent by a single user.\"\"\"\n    relevant_messages = tuple(\n        msg\n        for msg in recent_messages\n        if (\n            msg.author == last_message.author\n            and msg.content == last_message.content\n        )\n    )\n\n    total_duplicated = len(relevant_messages)\n\n    if total_duplicated > config['max']:\n        return (\n            f\"sent {total_duplicated} duplicated messages in {config['interval']}s\",\n            (last_message.author,),\n            relevant_messages\n        )\n    return None\n", "path": "bot/rules/duplicates.py"}], "after_files": [{"content": "from typing import Dict, Iterable, List, Optional, Tuple\n\nfrom discord import Member, Message\n\n\nasync def apply(\n    last_message: Message, recent_messages: List[Message], config: Dict[str, int]\n) -> Optional[Tuple[str, Iterable[Member], Iterable[Message]]]:\n    \"\"\"Detects duplicated messages sent by a single user.\"\"\"\n    relevant_messages = tuple(\n        msg\n        for msg in recent_messages\n        if (\n            msg.author == last_message.author\n            and msg.content == last_message.content\n            and msg.content\n        )\n    )\n\n    total_duplicated = len(relevant_messages)\n\n    if total_duplicated > config['max']:\n        return (\n            f\"sent {total_duplicated} duplicated messages in {config['interval']}s\",\n            (last_message.author,),\n            relevant_messages\n        )\n    return None\n", "path": "bot/rules/duplicates.py"}]}