Browse Source

Add support for getting the attachment's title

pull/10109/head
Soheab 10 months ago
committed by dolfies
parent
commit
2bf56a91f4
  1. 6
      discord/message.py

6
discord/message.py

@ -197,6 +197,10 @@ class Attachment(Hashable):
waveform: Optional[:class:`bytes`]
The waveform (amplitudes) of the audio in bytes. Returns ``None`` if it's not a voice message.
.. versionadded:: 2.1
title: Optional[:class:`str`]
The normalised version of the attachment's filename.
.. versionadded:: 2.1
"""
@ -215,6 +219,7 @@ class Attachment(Hashable):
'duration',
'waveform',
'_flags',
'title',
)
def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
@ -230,6 +235,7 @@ class Attachment(Hashable):
self.description: Optional[str] = data.get('description')
self.ephemeral: bool = data.get('ephemeral', False)
self.duration: Optional[float] = data.get('duration_secs')
self.title: Optional[str] = data.get('title')
waveform = data.get('waveform')
self.waveform: Optional[bytes] = utils._base64_to_bytes(waveform) if waveform is not None else None

Loading…
Cancel
Save