Move all async object creation to a proper initialisation point

This should make it so no object is created with another loop
This commit is contained in:
Rapptz
2022-03-13 08:26:39 -04:00
parent 8d4f08a5e7
commit 9c61e10a55
4 changed files with 45 additions and 27 deletions

View File

@ -424,8 +424,11 @@ class AutoShardedClient(Client):
self._connection.shards_launched.set()
async def connect(self, *, reconnect: bool = True) -> None:
async def _async_setup_hook(self) -> None:
await super()._async_setup_hook()
self.__queue = asyncio.PriorityQueue()
async def connect(self, *, reconnect: bool = True) -> None:
self._reconnect = reconnect
await self.launch_shards()