mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-01-14 16:14:07 +01:00
Added commands I think
This commit is contained in:
parent
80ef48ccc4
commit
bb13c79e75
@ -38,7 +38,7 @@ async def on_ready():
|
|||||||
game=discord.Game(name="Embed your Discord server! Visit https://TitanEmbeds.tk/"), status=discord.Status.online
|
game=discord.Game(name="Embed your Discord server! Visit https://TitanEmbeds.tk/"), status=discord.Status.online
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await database = DatabaseInterface(bot, config["database-uri"] + "?charset=utf8mb4")
|
database = DatabaseInterface(bot, config["database-uri"] + "?charset=utf8mb4")
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.error("Unable to connect to specified database!")
|
logger.error("Unable to connect to specified database!")
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
@ -18,12 +18,10 @@ from titanembeds.database.unauthenticated_bans import UnauthenticatedBans
|
|||||||
|
|
||||||
class DatabaseInterface(object):
|
class DatabaseInterface(object):
|
||||||
# Courtesy of https://github.com/SunDwarf/Jokusoramame
|
# Courtesy of https://github.com/SunDwarf/Jokusoramame
|
||||||
async def __init__(self, bot, dburi):
|
def __init__(self, bot, dburi):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
self.engine = create_engine(dburi, pool_recycle=10)
|
||||||
async with threadpool():
|
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
|
@contextmanager
|
||||||
def get_session(self) -> Session:
|
def get_session(self) -> Session:
|
||||||
|
Loading…
Reference in New Issue
Block a user