Create aiohttp session in on_ready to avoid separate loops
Fixes `RuntimeError: Timeout context manager should be used inside a task` errors when querying arkhamdb
This commit is contained in:
parent
7dadef6911
commit
2684d6083b
@ -30,8 +30,6 @@ class ArkhamDBUpdater(discord.Client):
|
||||
with open(self.channel_list_file) as f:
|
||||
self.channel_list = set(json.load(f))
|
||||
|
||||
self.arkhamdb_client = ArkhamDBClient()
|
||||
|
||||
async def close(self) -> None:
|
||||
await self.arkhamdb_client.close()
|
||||
await super().close()
|
||||
@ -66,6 +64,8 @@ class ArkhamDBUpdater(discord.Client):
|
||||
await tree.sync()
|
||||
|
||||
async def on_ready(self) -> None:
|
||||
self.arkhamdb_client = ArkhamDBClient()
|
||||
|
||||
logging.info(f"Logged in as {self.user} (ID: {self.user.id})")
|
||||
expected_permissions = permissions = discord.Permissions(
|
||||
read_messages=True,
|
||||
|
Loading…
Reference in New Issue
Block a user