diff options
| author | Rapptz <[email protected]> | 2016-12-24 05:11:06 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-01-03 09:52:02 -0500 |
| commit | 79a49f91458159564ae5a7696797829c6a848a5d (patch) | |
| tree | 0b588b8c3ef275f47061e8da47e6ca8a88403080 /discord/gateway.py | |
| parent | Rename MessageChannel.send_message to send and unify interface. (diff) | |
| download | discord.py-79a49f91458159564ae5a7696797829c6a848a5d.tar.xz discord.py-79a49f91458159564ae5a7696797829c6a848a5d.zip | |
Absolute import some circular dependencies to appease Python 3.4.
Diffstat (limited to 'discord/gateway.py')
| -rw-r--r-- | discord/gateway.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/discord/gateway.py b/discord/gateway.py index 169d6fb1..8d1f7040 100644 --- a/discord/gateway.py +++ b/discord/gateway.py @@ -28,7 +28,10 @@ import sys import websockets import asyncio import aiohttp -from . import utils, compat + +import discord.utils +import discord.compat + from .enums import Status, try_enum from .game import Game from .errors import GatewayNotFound, ConnectionClosed, InvalidArgument @@ -70,7 +73,7 @@ class KeepAliveHandler(threading.Thread): data = self.get_payload() log.debug(self.msg.format(data)) coro = self.ws.send_as_json(data) - f = compat.run_coroutine_threadsafe(coro, loop=self.ws.loop) + f = discord.compat.run_coroutine_threadsafe(coro, loop=self.ws.loop) try: # block until sending is complete f.result() @@ -400,7 +403,7 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): @asyncio.coroutine def send_as_json(self, data): try: - yield from super().send(utils.to_json(data)) + yield from super().send(discord.utils.to_json(data)) except websockets.exceptions.ConnectionClosed as e: if not self._can_handle_close(e.code): raise ConnectionClosed(e) from e @@ -428,7 +431,7 @@ class DiscordWebSocket(websockets.client.WebSocketClientProtocol): } } - sent = utils.to_json(payload) + sent = discord.utils.to_json(payload) log.debug('Sending "{}" to change status'.format(sent)) yield from self.send(sent) @@ -510,7 +513,7 @@ class DiscordVoiceWebSocket(websockets.client.WebSocketClientProtocol): @asyncio.coroutine def send_as_json(self, data): - yield from self.send(utils.to_json(data)) + yield from self.send(discord.utils.to_json(data)) @classmethod @asyncio.coroutine |