Add ephemeral attachment field
This commit is contained in:
parent
75a23351c4
commit
bde52a7449
@ -169,9 +169,14 @@ class Attachment(Hashable):
|
|||||||
The attachment's `media type <https://en.wikipedia.org/wiki/Media_type>`_
|
The attachment's `media type <https://en.wikipedia.org/wiki/Media_type>`_
|
||||||
|
|
||||||
.. versionadded:: 1.7
|
.. 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):
|
def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
|
||||||
self.id: int = int(data["id"])
|
self.id: int = int(data["id"])
|
||||||
@ -183,6 +188,7 @@ class Attachment(Hashable):
|
|||||||
self.proxy_url: str = data.get("proxy_url")
|
self.proxy_url: str = data.get("proxy_url")
|
||||||
self._http = state.http
|
self._http = state.http
|
||||||
self.content_type: Optional[str] = data.get("content_type")
|
self.content_type: Optional[str] = data.get("content_type")
|
||||||
|
self.ephemeral: Optional[bool] = data.get("ephemeral")
|
||||||
|
|
||||||
def is_spoiler(self) -> bool:
|
def is_spoiler(self) -> bool:
|
||||||
""":class:`bool`: Whether this attachment contains a spoiler."""
|
""":class:`bool`: Whether this attachment contains a spoiler."""
|
||||||
|
@ -53,6 +53,7 @@ class _AttachmentOptional(TypedDict, total=False):
|
|||||||
height: Optional[int]
|
height: Optional[int]
|
||||||
width: Optional[int]
|
width: Optional[int]
|
||||||
content_type: str
|
content_type: str
|
||||||
|
ephemeral: bool
|
||||||
spoiler: bool
|
spoiler: bool
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user