move db setup into start function
This commit is contained in:
parent
f447ddfd79
commit
cef9345765
1 changed files with 5 additions and 1 deletions
|
@ -60,7 +60,7 @@ class Nomen(Bot):
|
||||||
intents=options.get("intents"),
|
intents=options.get("intents"),
|
||||||
)
|
)
|
||||||
|
|
||||||
self.db = self.loop.run_until_complete(setup_db(DB_FILE))
|
self.db = None # Setup in start
|
||||||
self.prefixes = {}
|
self.prefixes = {}
|
||||||
|
|
||||||
async def get_guild_prefix(self, guild: Guild):
|
async def get_guild_prefix(self, guild: Guild):
|
||||||
|
@ -84,6 +84,10 @@ class Nomen(Bot):
|
||||||
)
|
)
|
||||||
self.prefixes[guild.id] = prefix
|
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):
|
async def close(self):
|
||||||
await super().close()
|
await super().close()
|
||||||
await self.db.close()
|
await self.db.close()
|
||||||
|
|
Loading…
Reference in a new issue