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):