diff --git a/ahtcg_bot.py b/ahtcg_bot.py index da5c7a8..b6d5767 100755 --- a/ahtcg_bot.py +++ b/ahtcg_bot.py @@ -25,6 +25,10 @@ class ArkhamDBUpdater(commands.Bot): self.arkhamdb_client = ArkhamDBClient() self.setup_commands() + async def close(self) -> None: + await self.arkhamdb_client.close() + await super().close() + def setup_commands(self): @self.command(name='monitor') async def monitor(ctx: commands.Context): diff --git a/arkhamdb.py b/arkhamdb.py index 8ebf403..e2b9b7b 100644 --- a/arkhamdb.py +++ b/arkhamdb.py @@ -17,10 +17,6 @@ class ArkhamDBClient: self._session = aiohttp.ClientSession() self.origin = arkhamdb_origin - def __del__(self): - loop = asyncio.get_event_loop() - loop.run_until_complete(self.close()) - async def close(self): await self._session.close()