Skip to content

Commit 267a644

Browse files
authored
feat: add Attachment.title (#2486)
1 parent a344a50 commit 267a644

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ These changes are available on the `master` branch, but have not yet been releas
3232
([#2409](https://github.com/Pycord-Development/pycord/pull/2409)
3333
- Added support for one-time purchases for Discord monetization.
3434
([#2438](https://github.com/Pycord-Development/pycord/pull/2438))
35+
- Added `Attachment.title`.
36+
([#2486](https://github.com/Pycord-Development/pycord/pull/2486))
3537

3638
### Fixed
3739

discord/message.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ class Attachment(Hashable):
155155
The attachment's width, in pixels. Only applicable to images and videos.
156156
filename: :class:`str`
157157
The attachment's filename.
158+
title: Optional[:class:`str`]
159+
The attachment's title. This is equal to the original :attr:`filename` (without an extension)
160+
if special characters were filtered from it.
161+
162+
.. versionadded:: 2.6
158163
url: :class:`str`
159164
The attachment URL. If the message this attachment was attached
160165
to is deleted, then this will 404.
@@ -213,6 +218,7 @@ class Attachment(Hashable):
213218
"_ex",
214219
"_is",
215220
"hm",
221+
"title",
216222
)
217223

218224
def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
@@ -221,6 +227,7 @@ def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
221227
self.height: int | None = data.get("height")
222228
self.width: int | None = data.get("width")
223229
self.filename: str = data["filename"]
230+
self.title: str | None = data.get("title")
224231
self.url: str = data.get("url")
225232
self.proxy_url: str = data.get("proxy_url")
226233
self._http = state.http

discord/types/message.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class Attachment(TypedDict):
8080
duration_secs: NotRequired[float]
8181
waveform: NotRequired[str]
8282
flags: NotRequired[int]
83+
title: NotRequired[str]
8384

8485

8586
MessageActivityType = Literal[1, 2, 3, 5]

0 commit comments

Comments
 (0)