diff --git a/CHANGELOG.md b/CHANGELOG.md index 04e709d410..6c75a9b1e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2409](https://github.com/Pycord-Development/pycord/pull/2409) - Added support for one-time purchases for Discord monetization. ([#2438](https://github.com/Pycord-Development/pycord/pull/2438)) +- Added `Attachment.title`. + ([#2486](https://github.com/Pycord-Development/pycord/pull/2486)) ### Fixed diff --git a/discord/message.py b/discord/message.py index 109bef02c8..23a81bbd96 100644 --- a/discord/message.py +++ b/discord/message.py @@ -155,6 +155,11 @@ class Attachment(Hashable): The attachment's width, in pixels. Only applicable to images and videos. filename: :class:`str` The attachment's filename. + title: Optional[:class:`str`] + The attachment's title. This is equal to the original :attr:`filename` (without an extension) + if special characters were filtered from it. + + .. versionadded:: 2.6 url: :class:`str` The attachment URL. If the message this attachment was attached to is deleted, then this will 404. @@ -213,6 +218,7 @@ class Attachment(Hashable): "_ex", "_is", "hm", + "title", ) def __init__(self, *, data: AttachmentPayload, state: ConnectionState): @@ -221,6 +227,7 @@ def __init__(self, *, data: AttachmentPayload, state: ConnectionState): self.height: int | None = data.get("height") self.width: int | None = data.get("width") self.filename: str = data["filename"] + self.title: str | None = data.get("title") self.url: str = data.get("url") self.proxy_url: str = data.get("proxy_url") self._http = state.http diff --git a/discord/types/message.py b/discord/types/message.py index 8988891efa..a29d1487a4 100644 --- a/discord/types/message.py +++ b/discord/types/message.py @@ -80,6 +80,7 @@ class Attachment(TypedDict): duration_secs: NotRequired[float] waveform: NotRequired[str] flags: NotRequired[int] + title: NotRequired[str] MessageActivityType = Literal[1, 2, 3, 5]