from peewee import Model,CharField from playhouse.db_url import connect # TODO: create connection to bot database db = connect("sqlite:///db.db") class WebUser(Model): username = CharField() password_hash = CharField() class Meta: db_table = "webusers" database = db @staticmethod def userExists(username) -> bool: """Check if the username exists in a database.""" query = WebUser.select().where(WebUser.username == username) if (query): if (query.exists()): return True return False def build_models(): db.create_tables([WebUser])