Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 8 additions & 0 deletions discord/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ class Attachment(Hashable):
The unique signature of this attachment's instance.

.. versionadded:: 2.5

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
"""

__slots__ = (
Expand All @@ -213,6 +219,7 @@ class Attachment(Hashable):
"_ex",
"_is",
"hm",
"title",
)

def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
Expand All @@ -221,6 +228,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