mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-21 00:07:51 +00:00
Add content_type to Attachment
This commit is contained in:
parent
5b244a7002
commit
f8d7be5b78
@ -111,9 +111,13 @@ class Attachment(Hashable):
|
||||
The proxy URL. This is a cached version of the :attr:`~Attachment.url` in the
|
||||
case of images. When the message is deleted, this URL might be valid for a few
|
||||
minutes or not valid at all.
|
||||
content_type: Optional[:class:`str`]
|
||||
The attachment's `media type <https://en.wikipedia.org/wiki/Media_type>`_
|
||||
|
||||
.. versionadded: 1.7
|
||||
"""
|
||||
|
||||
__slots__ = ('id', 'size', 'height', 'width', 'filename', 'url', 'proxy_url', '_http')
|
||||
__slots__ = ('id', 'size', 'height', 'width', 'filename', 'url', 'proxy_url', '_http', 'content_type')
|
||||
|
||||
def __init__(self, *, data, state):
|
||||
self.id = int(data['id'])
|
||||
@ -124,6 +128,7 @@ class Attachment(Hashable):
|
||||
self.url = data.get('url')
|
||||
self.proxy_url = data.get('proxy_url')
|
||||
self._http = state.http
|
||||
self.content_type = data.get('content_type')
|
||||
|
||||
def is_spoiler(self):
|
||||
""":class:`bool`: Whether this attachment contains a spoiler."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user