Add ephemeral attachment field

This commit is contained in:
Gnome 2021-09-18 14:58:35 +01:00
parent 75a23351c4
commit bde52a7449
2 changed files with 8 additions and 1 deletions

View File

@ -169,9 +169,14 @@ class Attachment(Hashable):
The attachment's `media type <https://en.wikipedia.org/wiki/Media_type>`_
.. versionadded:: 1.7
ephemeral: Optional[:class:`bool`]
If the attachment is ephemeral. Ephemeral attachments are temporary and
will automatically be removed after a set period of time.
.. versionadded:: 2.0
"""
__slots__ = ("id", "size", "height", "width", "filename", "url", "proxy_url", "_http", "content_type")
__slots__ = ("id", "size", "height", "width", "filename", "url", "proxy_url", "ephemeral" "_http", "content_type")
def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
self.id: int = int(data["id"])
@ -183,6 +188,7 @@ class Attachment(Hashable):
self.proxy_url: str = data.get("proxy_url")
self._http = state.http
self.content_type: Optional[str] = data.get("content_type")
self.ephemeral: Optional[bool] = data.get("ephemeral")
def is_spoiler(self) -> bool:
""":class:`bool`: Whether this attachment contains a spoiler."""

View File

@ -53,6 +53,7 @@ class _AttachmentOptional(TypedDict, total=False):
height: Optional[int]
width: Optional[int]
content_type: str
ephemeral: bool
spoiler: bool