fix(aurora): fixed an error in utils.get_next_case_number

This commit is contained in:
Seaswimmer 2024-01-08 09:38:12 +00:00
parent 719f02bde7
commit 90e80d1018
Signed by untrusted user: cswimr
GPG key ID: D74DDDDF420E13DF

View file

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