fix(aurora): convert timedeltas to strings before creating changes from them
Some checks failed
Actions / Build Documentation (MkDocs) (pull_request) Successful in 29s
Actions / Lint Code (Ruff & Pylint) (pull_request) Failing after 42s

This commit is contained in:
Seaswimmer 2024-08-19 14:46:08 -04:00
parent 3e484e1ae5
commit 3d3036f9b6
Signed by: cswimr
GPG key ID: 3813315477F26F82

View file

@ -37,7 +37,7 @@ from .utilities.config import config, register_config
from .utilities.factory import addrole_embed, case_factory, changes_factory, evidenceformat_factory, guild_embed, immune_embed, overrides_embed, type_embed from .utilities.factory import addrole_embed, case_factory, changes_factory, evidenceformat_factory, guild_embed, immune_embed, overrides_embed, type_embed
from .utilities.json import dump from .utilities.json import dump
from .utilities.logger import logger from .utilities.logger import logger
from .utilities.utils import check_moddable, check_permissions, create_guild_table, log, timedelta_from_relativedelta from .utilities.utils import check_moddable, check_permissions, create_guild_table, log, timedelta_from_relativedelta, timedelta_to_string
class Aurora(commands.Cog): class Aurora(commands.Cog):
@ -1081,7 +1081,7 @@ class Aurora(commands.Cog):
"timestamp": old_moderation.timestamp, "timestamp": old_moderation.timestamp,
"reason": old_moderation.reason, "reason": old_moderation.reason,
"user_id": old_moderation.moderator_id, "user_id": old_moderation.moderator_id,
"duration": old_moderation.duration, "duration": timedelta_to_string(old_moderation.duration),
"end_timestamp": old_moderation.end_timestamp, "end_timestamp": old_moderation.end_timestamp,
})) }))
moderation.changes.append(Change.from_dict(interaction.client, { moderation.changes.append(Change.from_dict(interaction.client, {
@ -1089,7 +1089,7 @@ class Aurora(commands.Cog):
"timestamp": int(time.time()), "timestamp": int(time.time()),
"reason": moderation.reason, "reason": moderation.reason,
"user_id": interaction.user.id, "user_id": interaction.user.id,
"duration": moderation.duration, "duration": timedelta_to_string(old_moderation.duration),
"end_timestamp": moderation.end_timestamp, "end_timestamp": moderation.end_timestamp,
})) }))