Browse Source

Add spoiler attribute to File

pull/6325/head
Josh 4 years ago
committed by GitHub
parent
commit
fce67c32c9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      discord/file.py

4
discord/file.py

@ -58,7 +58,7 @@ class File:
Whether the attachment is a spoiler.
"""
__slots__ = ('fp', 'filename', '_original_pos', '_owner', '_closer')
__slots__ = ('fp', 'filename', 'spoiler', '_original_pos', '_owner', '_closer')
def __init__(self, fp, filename=None, *, spoiler=False):
self.fp = fp
@ -92,6 +92,8 @@ class File:
if spoiler and self.filename is not None and not self.filename.startswith('SPOILER_'):
self.filename = 'SPOILER_' + self.filename
self.spoiler = spoiler or (self.filename is not None and self.filename.startswith('SPOILER_'))
def reset(self, *, seek=True):
# The `seek` parameter is needed because
# the retry-loop is iterated over multiple times

Loading…
Cancel
Save