aboutsummaryrefslogtreecommitdiff
path: root/discord/message.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-04-16 11:38:56 -0400
committerRapptz <[email protected]>2021-04-16 11:38:56 -0400
commit6ba3d89076a6559895561e450a6110f015468c29 (patch)
tree59c31d7b0dcc137b8a62a82b9e6adcfbd2227f5c /discord/message.py
parentRewrite Asset design (diff)
downloaddiscord.py-6ba3d89076a6559895561e450a6110f015468c29.tar.xz
discord.py-6ba3d89076a6559895561e450a6110f015468c29.zip
Revert Attachment.save code to prior implementation
Diffstat (limited to 'discord/message.py')
-rw-r--r--discord/message.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/discord/message.py b/discord/message.py
index 97d42704..eadd03e5 100644
--- a/discord/message.py
+++ b/discord/message.py
@@ -172,11 +172,11 @@ class Attachment(Hashable):
The number of bytes written.
"""
data = await self.read(use_cached=use_cached)
- if isinstance(fp, io.RawIOBase):
+ if isinstance(fp, io.IOBase) and fp.writable():
written = fp.write(data)
if seek_begin:
fp.seek(0)
- return written or 0
+ return written
else:
with open(fp, 'wb') as f:
return f.write(data)