mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 20:28:38 +00:00
Add support for getting the attachment's title
This commit is contained in:
parent
38bbfed717
commit
a6d1dc0455
@ -194,6 +194,10 @@ class Attachment(Hashable):
|
|||||||
The waveform (amplitudes) of the audio in bytes. Returns ``None`` if it's not a voice message.
|
The waveform (amplitudes) of the audio in bytes. Returns ``None`` if it's not a voice message.
|
||||||
|
|
||||||
.. versionadded:: 2.3
|
.. versionadded:: 2.3
|
||||||
|
title: Optional[:class:`str`]
|
||||||
|
The normalised version of the attachment's filename.
|
||||||
|
|
||||||
|
.. versionadded:: 2.5
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
@ -211,6 +215,7 @@ class Attachment(Hashable):
|
|||||||
'duration',
|
'duration',
|
||||||
'waveform',
|
'waveform',
|
||||||
'_flags',
|
'_flags',
|
||||||
|
'title',
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
|
def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
|
||||||
@ -226,6 +231,7 @@ class Attachment(Hashable):
|
|||||||
self.description: Optional[str] = data.get('description')
|
self.description: Optional[str] = data.get('description')
|
||||||
self.ephemeral: bool = data.get('ephemeral', False)
|
self.ephemeral: bool = data.get('ephemeral', False)
|
||||||
self.duration: Optional[float] = data.get('duration_secs')
|
self.duration: Optional[float] = data.get('duration_secs')
|
||||||
|
self.title: Optional[str] = data.get('title')
|
||||||
|
|
||||||
waveform = data.get('waveform')
|
waveform = data.get('waveform')
|
||||||
self.waveform: Optional[bytes] = utils._base64_to_bytes(waveform) if waveform is not None else None
|
self.waveform: Optional[bytes] = utils._base64_to_bytes(waveform) if waveform is not None else None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user