Add Attachment.ephemeral

This commit is contained in:
Stocker 2022-03-06 22:59:15 -05:00 committed by GitHub
parent 1bfe3bdff1
commit 12d4de52a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View File

@ -170,10 +170,26 @@ class Attachment(Hashable):
description: Optional[:class:`str`]
The attachment's description. Only applicable to images.
.. versionadded:: 2.0
ephemeral: :class:`bool`
Whether the attachment is ephemeral.
.. versionadded:: 2.0
"""
__slots__ = ('id', 'size', 'height', 'width', 'filename', 'url', 'proxy_url', '_http', 'content_type', 'description')
__slots__ = (
'id',
'size',
'height',
'width',
'filename',
'url',
'proxy_url',
'_http',
'content_type',
'description',
'ephemeral',
)
def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
self.id: int = int(data['id'])
@ -186,6 +202,7 @@ class Attachment(Hashable):
self._http = state.http
self.content_type: Optional[str] = data.get('content_type')
self.description: Optional[str] = data.get('description')
self.ephemeral: bool = data.get('ephemeral', False)
def is_spoiler(self) -> bool:
""":class:`bool`: Whether this attachment contains a spoiler."""

View File

@ -63,6 +63,7 @@ class _AttachmentOptional(TypedDict, total=False):
description: str
content_type: str
spoiler: bool
ephemeral: bool
class Attachment(_AttachmentOptional):