diff options
-rw-r--r-- | discord/client.py | 9 | ||||
-rw-r--r-- | discord/utils/__init__.py | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/discord/client.py b/discord/client.py index fc9bcd5..5f5c3b0 100644 --- a/discord/client.py +++ b/discord/client.py @@ -9,8 +9,7 @@ import zlib import aiohttp import websockets -from .utils import EventEmitter -from .utils.rest import RESTClient +from .utils import EventEmitter, RESTClient from .intents import Intents, get_number from .user import User @@ -55,7 +54,7 @@ class Client: @property async def user(self): """The `discord.user.User` associated with the client.""" - data = await self.rest_client.get(self._token, '/users/@me') + data = await self.rest_client.get('/users/@me') return User(data) def __init__(self, intents: list[Intents]): @@ -88,7 +87,6 @@ class Client: - intent_code: The number which represents the `discord.intents.Intents` being used. """ async with websockets.connect("wss://gateway.discord.gg/?v=10&encoding=json") as gateway: - hello = await gateway.recv() self.gateway = gateway threading.Thread(target=self.loop.run_forever).start() while True: @@ -167,7 +165,7 @@ class Client: "op": 1, "d": None } - await self.gateway.send(json.dumps(heartbeat)) + await self.send(heartbeat) async def identify(self): """ @@ -185,6 +183,7 @@ class Client: } } } + await self.send(identify) def event(self, coro: Optional[Callable[..., Coroutine[Any, Any, Any]]] = None, /) -> Optional[ Callable[..., Coroutine[Any, Any, Any]]]: diff --git a/discord/utils/__init__.py b/discord/utils/__init__.py index 337f2e6..199f0c8 100644 --- a/discord/utils/__init__.py +++ b/discord/utils/__init__.py @@ -1 +1,3 @@ from .event_emitter import * +from .exceptions import * +from .rest import * \ No newline at end of file |