Repository: Pycord-Development/pycord

Issue:
KeyError when getting thumbnail url from embed
### Summary

`Embed.thumbnail.url` returns `KeyError` from function expecting more keys in the thumbnail data

### Reproduction Steps

This only occurs on master possibly since the embed refactor: #2063
- Add a thumbnail to an embed
- Get the thumbnail url using `Embed.thumbnail.url`

### Minimal Reproducible Code

```python
@bridge.bridge_command(name='test', description="Hello World")
@commands.cooldown(**config.default_cooldown_options)
@commands.bot_has_permissions(send_messages=True)
async def test_cmd(self, ctx: bridge.BridgeContext):
    embed = discord.Embed(title="Hello World",
                          thumbnail="https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg")
    thumb_url = embed.thumbnail.url
    await ctx.respond(embed=embed)
```


### Expected Results

On the stable 2.4.1 and earlier, it just returns the url as a string or None if there isn't one

### Actual Results

The classmethod `from_dict` for `EmbedMedia` on line 184 in `embeds.py` is expecting `width` and `height` keys in the data provided. However, the data only has the `url` so it raises a KeyError as follows:
```python
Traceback:
  File "bot-dir/venv/lib/python3.11/site-packages/discord/commands/core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^

  File "bot-dir/venv/lib/python3.11/site-packages/discord/commands/core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)

  File "bot-dir/cogs/testing.py", line 27, in test_cmd
    thumb_url = embed.thumbnail.url
                ^^^^^^^^^^^^^^^

  File "bot-dir/venv/lib/python3.11/site-packages/discord/embeds.py", line 687, in thumbnail
    return EmbedMedia.from_dict(thumb)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "bot-dir/venv/lib/python3.11/site-packages/discord/embeds.py", line 184, in from_dict
    self.height = int(data["height"])
                      ~~~~^^^^^^^^^^

 KeyError: 'height'. 
```


### Intents

all

### System Information

- Python v3.11.3-final
- py-cord v2.4.1-final
- aiohttp v3.8.4
- system info: Linux 6.3.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 05 Jun 2023 15:12:57 +0000

### Checklist

- [X] I have searched the open issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have removed my token from display, if visible.

### Additional Context

_No response_


Discussion:
Ah damn I forgot one could access `embed.thumbnail` or other media attributes from the user generated embed. I'll fix in a bit

Resolving patch:
diff --git a/discord/embeds.py b/discord/embeds.py
--- a/discord/embeds.py
+++ b/discord/embeds.py
@@ -173,16 +173,18 @@ class EmbedMedia:  # Thumbnail, Image, Video
 
     url: str
     proxy_url: str | None
-    height: int
-    width: int
+    height: int | None
+    width: int | None
 
     @classmethod
     def from_dict(cls, data: dict[str, str | int]) -> EmbedMedia:
         self = cls.__new__(cls)
         self.url = str(data.get("url"))
-        self.proxy_url = str(data.get("proxy_url"))
-        self.height = int(data["height"])
-        self.width = int(data["width"])
+        self.proxy_url = (
+            str(proxy_url) if (proxy_url := data.get("proxy_url")) else None
+        )
+        self.height = int(height) if (height := data.get("height")) else None
+        self.width = int(width) if (width := data.get("width")) else None
         return self
 
     def __repr__(self) -> str:


Test patch: