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 def userExists(self,username) -> bool: """Check if the username exists in a database.""" query = WebUser.select().where(WebUser.username == username) if (not query) or (not query.exists()): return False return True def build_models(): db.create_tables([WebUser])