Create ArkhamDBClient in setup_hook instead of on_ready

This commit is contained in:
Adam Goldsmith 2022-06-06 21:34:06 -04:00
parent c429278cc8
commit bbd899cdfb
1 changed files with 3 additions and 2 deletions

View File

@ -30,6 +30,9 @@ class ArkhamDBUpdater(discord.Client):
with open(self.channel_list_file) as f:
self.channel_list = set(json.load(f))
async def setup_hook(self) -> None:
self.arkhamdb_client = ArkhamDBClient()
async def close(self) -> None:
await self.arkhamdb_client.close()
await super().close()
@ -81,8 +84,6 @@ 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,