Browse Source

Have use_cached=True by default for Attachment.save.

Also touch up the documentation a bit.
pull/1963/head
Rapptz 6 years ago
parent
commit
aceec2009a
  1. 16
      discord/message.py

16
discord/message.py

@ -77,7 +77,7 @@ class Attachment:
""":class:`bool`: Whether this attachment contains a spoiler.""" """:class:`bool`: Whether this attachment contains a spoiler."""
return self.filename.startswith('SPOILER_') return self.filename.startswith('SPOILER_')
async def save(self, fp, *, seek_begin=True, use_cached=False): async def save(self, fp, *, seek_begin=True, use_cached=True):
"""|coro| """|coro|
Saves this attachment into a file-like object. Saves this attachment into a file-like object.
@ -88,15 +88,15 @@ class Attachment:
The file-like object to save this attachment to or the filename The file-like object to save this attachment to or the filename
to use. If a filename is passed then a file is created with that to use. If a filename is passed then a file is created with that
filename and used instead. filename and used instead.
seek_begin: bool seek_begin: :class:`bool`
Whether to seek to the beginning of the file after saving is Whether to seek to the beginning of the file after saving is
successfully done. successfully done.
use_cached: bool use_cached: :class:`bool`
Whether to use the proxy_url property, rather than the url Whether to use :attr:`proxy_url` rather than :attr:`url` when downloading
property, as the attachment source. This will allow attachments the attachment. This will allow attachments to be saved after deletion
to be saved after deletion more often than with the url, which more often, which is generally deleted right after the message is deleted.
is deleted after the message is deleted. Note that use_cached will Note that this can still fail to download deleted attachments if too much time
still fail after an uncertain amount of time. has passed.
Raises Raises
-------- --------

Loading…
Cancel
Save