Merge pull request #63
* Add ephemeral attachment field * I did not miss a comma
This commit is contained in:
parent
e65415d3c8
commit
fba7ca420c
@ -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."""
|
||||
|
@ -53,6 +53,7 @@ class _AttachmentOptional(TypedDict, total=False):
|
||||
height: Optional[int]
|
||||
width: Optional[int]
|
||||
content_type: str
|
||||
ephemeral: bool
|
||||
spoiler: bool
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user