From ed6b3229c97b7d9003e52637f9c48ac08ceef21c Mon Sep 17 00:00:00 2001 From: mjk134 <57556877+mjk134@users.noreply.github.com> Date: Tue, 12 Jul 2022 18:57:37 +0000 Subject: fix(client): Bug with not receiving events as soon as they are fired --- discord/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/discord/client.py b/discord/client.py index b68edbb..3c15abd 100644 --- a/discord/client.py +++ b/discord/client.py @@ -80,7 +80,6 @@ class Client: rest_client: RESTClient client_cache: ClientCache = ClientCache() - @property async def user(self): """The `discord.user.User` associated with the client.""" data = await self.rest_client.get('/users/@me') @@ -172,6 +171,8 @@ class Client: event = msg['t'] + print(f"{event}") + match(event): case 'READY': self.ready = True @@ -259,7 +260,7 @@ class Client: async def poll_event(self): async for msg in self.gateway: - if msg.type == aiohttp.WSMsgType.TEXT: + if msg.type in (aiohttp.WSMsgType.TEXT, aiohttp.WSMsgType.BINARY): await self.recv(msg.data) elif msg.type == aiohttp.WSMsgType.CLOSED: break -- cgit 1.4.1-2-gfad0