aboutsummaryrefslogtreecommitdiff
path: root/discord
diff options
context:
space:
mode:
Diffstat (limited to 'discord')
-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)