From 12d4de52a8493af46b14927cd630392193b0421b Mon Sep 17 00:00:00 2001 From: Stocker <44980366+StockerMC@users.noreply.github.com> Date: Sun, 6 Mar 2022 22:59:15 -0500 Subject: [PATCH] Add Attachment.ephemeral --- discord/message.py | 19 ++++++++++++++++++- discord/types/message.py | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/discord/message.py b/discord/message.py index 20e520342..632a2f250 100644 --- a/discord/message.py +++ b/discord/message.py @@ -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.""" diff --git a/discord/types/message.py b/discord/types/message.py index 151b8add8..dd0ff1b07 100644 --- a/discord/types/message.py +++ b/discord/types/message.py @@ -63,6 +63,7 @@ class _AttachmentOptional(TypedDict, total=False): description: str content_type: str spoiler: bool + ephemeral: bool class Attachment(_AttachmentOptional):