diff options
| author | Rapptz <[email protected]> | 2017-01-03 08:41:44 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-01-03 09:52:10 -0500 |
| commit | 98b981848d757e8fb66d4a874a3107c0e8de2963 (patch) | |
| tree | f0969e87a7835b6b253fa1f47381ba4045b1ae2a /discord/http.py | |
| parent | Move away from StateContext and use ConnectionState directly. (diff) | |
| download | discord.py-98b981848d757e8fb66d4a874a3107c0e8de2963.tar.xz discord.py-98b981848d757e8fb66d4a874a3107c0e8de2963.zip | |
Move message creation to a factory method inside ConnectionState.
Diffstat (limited to 'discord/http.py')
| -rw-r--r-- | discord/http.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/discord/http.py b/discord/http.py index 2eda3c8a..2b885dec 100644 --- a/discord/http.py +++ b/discord/http.py @@ -36,9 +36,7 @@ from random import randint as random_integer log = logging.getLogger(__name__) from .errors import HTTPException, Forbidden, NotFound, LoginFailure, GatewayNotFound -from . import __version__ - -import discord.utils +from . import __version__, utils @asyncio.coroutine def json_or_text(response): @@ -99,7 +97,7 @@ class HTTPClient: # some checking if it's a JSON request if 'json' in kwargs: headers['Content-Type'] = 'application/json' - kwargs['data'] = discord.utils.to_json(kwargs.pop('json')) + kwargs['data'] = utils.to_json(kwargs.pop('json')) kwargs['headers'] = headers with (yield from lock): @@ -246,7 +244,7 @@ class HTTPClient: if embed: payload['embed'] = embed - form.add_field('payload_json', discord.utils.to_json(payload)) + form.add_field('payload_json', utils.to_json(payload)) form.add_field('file', buffer, filename=filename, content_type='application/octet-stream') return self.post(url, data=form, bucket='messages:' + str(guild_id)) |