diff --git a/chatter/chat.py b/chatter/chat.py index e3f14cc..1b81959 100644 --- a/chatter/chat.py +++ b/chatter/chat.py @@ -402,7 +402,13 @@ class Chatter(Cog): ) @commands.is_owner() - @chatter.command(name="minutes") + @chatter.group(name="trainset") + async def chatter_trainset(self, ctx: commands.Context): + """Commands for configuring training""" + pass + + @commands.is_owner() + @chatter_trainset.command(name="minutes") async def minutes(self, ctx: commands.Context, minutes: int): """ Sets the number of minutes the bot will consider a break in a conversation during training @@ -418,7 +424,7 @@ class Chatter(Cog): await ctx.tick() @commands.is_owner() - @chatter.command(name="age") + @chatter_trainset.command(name="age") async def age(self, ctx: commands.Context, days: int): """ Sets the number of days to look back diff --git a/chatter/storage_adapters.py b/chatter/storage_adapters.py index 6f11601..b2dc02a 100644 --- a/chatter/storage_adapters.py +++ b/chatter/storage_adapters.py @@ -5,7 +5,7 @@ class MyDumbSQLStorageAdapter(SQLStorageAdapter): def __init__(self, **kwargs): super(SQLStorageAdapter, self).__init__(**kwargs) - from sqlalchemy import create_engine + from sqlalchemy import create_engine, inspect from sqlalchemy.orm import sessionmaker self.database_uri = kwargs.get("database_uri", False) @@ -31,7 +31,7 @@ class MyDumbSQLStorageAdapter(SQLStorageAdapter): dbapi_connection.execute("PRAGMA journal_mode=WAL") dbapi_connection.execute("PRAGMA synchronous=NORMAL") - if not self.engine.dialect.has_table(self.engine, "Statement"): + if not inspect(self.engine).has_table('Statement'): self.create_database() self.Session = sessionmaker(bind=self.engine, expire_on_commit=True)