From bb13c79e75949d2833b50fdd29e02b288ebd5e42 Mon Sep 17 00:00:00 2001 From: JustMaffie Date: Sun, 28 May 2017 00:27:22 +0200 Subject: [PATCH] Added commands I think --- discordbot/titanembeds/bot.py | 2 +- discordbot/titanembeds/database/__init__.py | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/discordbot/titanembeds/bot.py b/discordbot/titanembeds/bot.py index c05bdc9..6898077 100644 --- a/discordbot/titanembeds/bot.py +++ b/discordbot/titanembeds/bot.py @@ -38,7 +38,7 @@ async def on_ready(): game=discord.Game(name="Embed your Discord server! Visit https://TitanEmbeds.tk/"), status=discord.Status.online ) try: - await database = DatabaseInterface(bot, config["database-uri"] + "?charset=utf8mb4") + database = DatabaseInterface(bot, config["database-uri"] + "?charset=utf8mb4") except Exception: logger.error("Unable to connect to specified database!") traceback.print_exc() diff --git a/discordbot/titanembeds/database/__init__.py b/discordbot/titanembeds/database/__init__.py index 6b1e315..978e54f 100644 --- a/discordbot/titanembeds/database/__init__.py +++ b/discordbot/titanembeds/database/__init__.py @@ -18,12 +18,10 @@ from titanembeds.database.unauthenticated_bans import UnauthenticatedBans class DatabaseInterface(object): # Courtesy of https://github.com/SunDwarf/Jokusoramame - async def __init__(self, bot, dburi): + def __init__(self, bot, dburi): self.bot = bot - - async with threadpool(): - self.engine = create_engine(dburi, pool_recycle=10) - self._sessionmaker = sessionmaker(bind=self.engine, expire_on_commit=False) + self.engine = create_engine(dburi, pool_recycle=10) + self._sessionmaker = sessionmaker(bind=self.engine, expire_on_commit=False) @contextmanager def get_session(self) -> Session: