diff --git a/naff/client/client.py b/naff/client/client.py index 21f7ef465..5c994afb2 100644 --- a/naff/client/client.py +++ b/naff/client/client.py @@ -775,13 +775,6 @@ async def _on_websocket_ready(self, event: events.RawGatewayEvent) -> None: self.logger.debug(f"Waiting for {guild.id} to chunk") await guild.chunked.wait() - # run any pending startup tasks - if self.async_startup_tasks: - try: - await asyncio.gather(*self.async_startup_tasks) - except Exception as e: - self.dispatch(events.Error("async-extension-loader", e)) - # cache slash commands if not self._startup: await self._init_interactions() @@ -848,6 +841,14 @@ async def astart(self, token: str) -> None: token: Your bot's token """ await self.login(token) + + # run any pending startup tasks + if self.async_startup_tasks: + try: + await asyncio.gather(*self.async_startup_tasks) + except Exception as e: + self.dispatch(events.Error("async-extension-loader", e)) + try: await self._connection_state.start() finally: