mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-18 15:06:07 +00:00
Fix attachment is_spoiler() and is_voice_message()
This commit is contained in:
parent
fbe2b358fc
commit
de5720e659
@ -254,11 +254,12 @@ class Attachment(Hashable):
|
||||
|
||||
def is_spoiler(self) -> bool:
|
||||
""":class:`bool`: Whether this attachment contains a spoiler."""
|
||||
return self.filename.startswith('SPOILER_')
|
||||
# The flag is technically always present but no harm to check both
|
||||
return self.filename.startswith('SPOILER_') or self.flags.spoiler
|
||||
|
||||
def is_voice_message(self) -> bool:
|
||||
""":class:`bool`: Whether this attachment is a voice message."""
|
||||
return self.duration is not None and 'voice-message' in self.url
|
||||
return self.duration is not None and self.waveform is not None
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f'<Attachment id={self.id} filename={self.filename!r} url={self.url!r}>'
|
||||
|
Loading…
x
Reference in New Issue
Block a user