From 90e80d10182b69816ba666fe9be3c201071a6f53 Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Mon, 8 Jan 2024 09:38:12 +0000 Subject: [PATCH] fix(aurora): fixed an error in utils.get_next_case_number --- aurora/utilities/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aurora/utilities/utils.py b/aurora/utilities/utils.py index 5c1992d..aeab27e 100644 --- a/aurora/utilities/utils.py +++ b/aurora/utilities/utils.py @@ -102,7 +102,7 @@ async def check_moddable( return True -async def get_next_case_number(guild_id: str, cursor=None): +async def get_next_case_number(guild_id: str, cursor = None) -> int: """This function returns the next case number from the MySQL table for a specific guild.""" from .database import connect @@ -112,7 +112,8 @@ async def get_next_case_number(guild_id: str, cursor=None): cursor.execute( f"SELECT moderation_id FROM `moderation_{guild_id}` ORDER BY moderation_id DESC LIMIT 1" ) - return cursor.fetchone()[0] + 1 + result = cursor.fetchone() + return (result[0] + 1) if result else 1 def generate_dict(result):