prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <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. 
  
  </issue>
  <code>
  [start of bot/rules/duplicates.py]
  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 of bot/rules/duplicates.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: 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
           )
       )
  
verification_info: {"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"}]}