fix(aurora): fixed an error
All checks were successful
Actions / Build Documentation (MkDocs) (pull_request) Successful in 32s
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 47s

This commit is contained in:
Seaswimmer 2024-05-04 13:48:57 -04:00
parent f3d6244a17
commit 14a04cff59
Signed by: cswimr
GPG key ID: 5D671B5D03D65A7F

View file

@ -31,13 +31,15 @@ class Moderation(BaseModel):
def from_sql(cls, moderation_id: int, guild: Guild): def from_sql(cls, moderation_id: int, guild: Guild):
query = f"SELECT * FROM moderation_{guild.id} WHERE moderation_id = ?;" query = f"SELECT * FROM moderation_{guild.id} WHERE moderation_id = ?;"
with connect() as database, database.cursor() as cursor: with connect() as database:
cursor = database.cursor()
cursor.execute(query, (moderation_id,)) cursor.execute(query, (moderation_id,))
result = cursor.fetchone() result = cursor.fetchone()
if result: if result:
moderation_data = dict(zip(cls.model_fields, result)) moderation_data = dict(zip(cls.model_fields, result))
moderation = cls(**moderation_data) moderation = cls(**moderation_data)
cursor.close()
return moderation return moderation
return None return None