aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZomatree <[email protected]>2020-05-14 00:35:48 +0100
committerRapptz <[email protected]>2020-05-23 21:56:40 -0400
commita22d38d00453320a2271ca79bf99bea31c520d0e (patch)
treeb8f4dc9b30f6a06b50af14f83a06a75c54f30fc6
parentFix TypeError in chunker (diff)
downloaddiscord.py-a22d38d00453320a2271ca79bf99bea31c520d0e.tar.xz
discord.py-a22d38d00453320a2271ca79bf99bea31c520d0e.zip
Add spoiler keyword argument to Attachment.to_file
-rw-r--r--discord/message.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/discord/message.py b/discord/message.py
index 87d0c973..884fce6f 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -166,7 +166,7 @@ class Attachment:
data = await self._http.get_from_cdn(url)
return data
- async def to_file(self, *, use_cached=False):
+ async def to_file(self, *, use_cached=False, spoiler=False):
"""|coro|
Converts the attachment into a :class:`File` suitable for sending via
@@ -185,6 +185,10 @@ class Attachment:
on some types of attachments.
.. versionadded:: 1.4
+ spoiler: :class:`bool`
+ Whether the file is a spoiler.
+
+ .. versionadded:: 1.4
Raises
------
@@ -202,7 +206,7 @@ class Attachment:
"""
data = await self.read(use_cached=use_cached)
- return File(io.BytesIO(data), filename=self.filename)
+ return File(io.BytesIO(data), filename=self.filename, spoiler=spoiler)
def flatten_handlers(cls):
prefix = len('_handle_')