fix(aurora): update the autologger method to use the new type registry
All checks were successful
Actions / Lint Code (Ruff & Pylint) (pull_request) Successful in 54s
Actions / Build Documentation (MkDocs) (pull_request) Successful in 29s

This commit is contained in:
Seaswimmer 2024-08-23 14:43:43 -04:00
parent 6560f98aef
commit 5459392d7e
Signed by: cswimr
GPG key ID: 3813315477F26F82

View file

@ -46,7 +46,7 @@ class Aurora(commands.Cog):
This cog stores all of its data in an SQLite database.""" This cog stores all of its data in an SQLite database."""
__author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"] __author__ = ["[cswimr](https://www.coastalcommits.com/cswimr)"]
__version__ = "3.0.0-indev22" __version__ = "3.0.0-indev23"
__git__ = "https://www.coastalcommits.com/cswimr/SeaCogs" __git__ = "https://www.coastalcommits.com/cswimr/SeaCogs"
__documentation__ = "https://seacogs.coastalcommits.com/aurora/" __documentation__ = "https://seacogs.coastalcommits.com/aurora/"
@ -189,13 +189,13 @@ class Aurora(commands.Cog):
reason = "This action was performed without the bot." reason = "This action was performed without the bot."
if entry.action == discord.AuditLogAction.kick: if entry.action == discord.AuditLogAction.kick:
moderation_type = "KICK" moderation_type = type_registry['kick']
elif entry.action == discord.AuditLogAction.ban: elif entry.action == discord.AuditLogAction.ban:
moderation_type = "BAN" moderation_type = type_registry['ban']
elif entry.action == discord.AuditLogAction.unban: elif entry.action == discord.AuditLogAction.unban:
moderation_type = "UNBAN" moderation_type = type_registry['unban']
elif entry.action == discord.AuditLogAction.member_update: elif entry.action == discord.AuditLogAction.member_update:
if entry.after.timed_out_until is not None: if entry.after.timed_out_until is not None:
@ -207,22 +207,22 @@ class Aurora(commands.Cog):
) )
minutes = round(duration_datetime.total_seconds() / 60) minutes = round(duration_datetime.total_seconds() / 60)
duration = timedelta(minutes=minutes) duration = timedelta(minutes=minutes)
moderation_type = "MUTE" moderation_type = type_registry['mute']
else: else:
moderation_type = "UNMUTE" moderation_type = type_registry['unmute']
else: else:
return return
await Moderation.log( await Moderation.log(
self.bot, bot=self.bot,
entry.guild.id, guild_id=entry.guild.id,
entry.user.id, moderator_id=entry.user.id,
moderation_type, moderation_type=moderation_type,
"USER", target_type="USER",
entry.target.id, target_id=entry.target.id,
None, role_id=None,
duration, duration=duration,
reason, reason=reason,
) )
except AttributeError: except AttributeError:
return return