aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--discord/client.py4
-rw-r--r--discord/http.py3
2 files changed, 3 insertions, 4 deletions
diff --git a/discord/client.py b/discord/client.py
index 3ef5bd74..4c1e36d1 100644
--- a/discord/client.py
+++ b/discord/client.py
@@ -49,7 +49,7 @@ import aiohttp
import websockets
import logging, traceback
-import sys, re
+import sys, re, io
import tempfile, os, hashlib
import itertools
import datetime
@@ -873,7 +873,7 @@ class Client:
try:
with open(fp, 'rb') as f:
- buffer = f.read()
+ buffer = io.BytesIO(f.read())
if filename is None:
filename = fp
except TypeError:
diff --git a/discord/http.py b/discord/http.py
index 15cd08ef..d8398920 100644
--- a/discord/http.py
+++ b/discord/http.py
@@ -29,7 +29,6 @@ import asyncio
import json
import sys
import logging
-import io
import inspect
import weakref
from random import randint as random_integer
@@ -239,7 +238,7 @@ class HTTPClient:
form.add_field('content', str(content))
form.add_field('tts', 'true' if tts else 'false')
- form.add_field('file', io.BytesIO(buffer), filename=filename, content_type='application/octet-stream')
+ form.add_field('file', buffer, filename=filename, content_type='application/octet-stream')
return self.post(url, data=form, bucket='messages:' + str(guild_id))