diff options
| -rw-r--r-- | bot/bot.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bot/bot.py b/bot/bot.py index 1d187f031..e1b1d81dc 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -58,6 +58,11 @@ class Bot(commands.Bot): async def login(self, *args, **kwargs) -> None: """Re-create the connector and set up sessions before logging into Discord.""" + self._recreate() + await super().login(*args, **kwargs) + + def _recreate(self) -> None: + """Re-create the connector, aiohttp session, and the APIClient.""" # Use asyncio for DNS resolution instead of threads so threads aren't spammed. # Use AF_INET as its socket family to prevent HTTPS related problems both locally # and in production. @@ -73,5 +78,3 @@ class Bot(commands.Bot): self.http_session = aiohttp.ClientSession(connector=self._connector) self.api_client.recreate(connector=self._connector) - - await super().login(*args, **kwargs) |