move db setup into start function

This commit is contained in:
Infinidoge 2024-12-20 01:13:21 -05:00
parent f447ddfd79
commit cef9345765
Signed by: Infinidoge
SSH key fingerprint: SHA256:GT2StvPQMMfFHyiiFJymQxfTG/z6EWLJ6NWItf5K5sA

View file

@ -60,7 +60,7 @@ class Nomen(Bot):
intents=options.get("intents"),
)
self.db = self.loop.run_until_complete(setup_db(DB_FILE))
self.db = None # Setup in start
self.prefixes = {}
async def get_guild_prefix(self, guild: Guild):
@ -84,6 +84,10 @@ class Nomen(Bot):
)
self.prefixes[guild.id] = prefix
async def start(self, *args, **kwargs):
self.db = await setup_db(DB_FILE)
await super().start(*args, **kwargs)
async def close(self):
await super().close()
await self.db.close()