From cef934576529d6629ba45739eeb581871cdabb77 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Fri, 20 Dec 2024 01:13:21 -0500 Subject: [PATCH] move db setup into start function --- nomen/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nomen/main.py b/nomen/main.py index 869ce1a..8764516 100644 --- a/nomen/main.py +++ b/nomen/main.py @@ -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()