Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions discord/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -213,6 +218,7 @@ class Attachment(Hashable):
"_ex",
"_is",
"hm",
"title",
)

def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions discord/types/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down