mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-07 12:18:59 +00:00
Add Attachment.ephemeral
This commit is contained in:
parent
1bfe3bdff1
commit
12d4de52a8
@ -170,10 +170,26 @@ class Attachment(Hashable):
|
|||||||
description: Optional[:class:`str`]
|
description: Optional[:class:`str`]
|
||||||
The attachment's description. Only applicable to images.
|
The attachment's description. Only applicable to images.
|
||||||
|
|
||||||
|
.. versionadded:: 2.0
|
||||||
|
ephemeral: :class:`bool`
|
||||||
|
Whether the attachment is ephemeral.
|
||||||
|
|
||||||
.. versionadded:: 2.0
|
.. 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):
|
def __init__(self, *, data: AttachmentPayload, state: ConnectionState):
|
||||||
self.id: int = int(data['id'])
|
self.id: int = int(data['id'])
|
||||||
@ -186,6 +202,7 @@ class Attachment(Hashable):
|
|||||||
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.description: Optional[str] = data.get('description')
|
self.description: Optional[str] = data.get('description')
|
||||||
|
self.ephemeral: bool = data.get('ephemeral', False)
|
||||||
|
|
||||||
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."""
|
||||||
|
@ -63,6 +63,7 @@ class _AttachmentOptional(TypedDict, total=False):
|
|||||||
description: str
|
description: str
|
||||||
content_type: str
|
content_type: str
|
||||||
spoiler: bool
|
spoiler: bool
|
||||||
|
ephemeral: bool
|
||||||
|
|
||||||
|
|
||||||
class Attachment(_AttachmentOptional):
|
class Attachment(_AttachmentOptional):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user