mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-06-06 20:07:17 +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`]
|
||||
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."""
|
||||
|
@ -63,6 +63,7 @@ class _AttachmentOptional(TypedDict, total=False):
|
||||
description: str
|
||||
content_type: str
|
||||
spoiler: bool
|
||||
ephemeral: bool
|
||||
|
||||
|
||||
class Attachment(_AttachmentOptional):
|
||||
|
Loading…
x
Reference in New Issue
Block a user