WIP: Refactor Aurora (3.0.0) #29

Draft
cswimr wants to merge 347 commits from aurora-pydantic into main
2 changed files with 5 additions and 5 deletions
Showing only changes of commit 0c628cf2a2 - Show all commits

View file

@ -42,7 +42,7 @@ class Moderation(AuroraGuildModel):
return self.moderation_id return self.moderation_id
@property @property
def type(self) -> str: def type(self) -> Type:
return self.moderation_type return self.moderation_type
@property @property

View file

@ -116,7 +116,7 @@ async def log_factory(
) )
resolved_by = await moderation.get_resolved_by() resolved_by = await moderation.get_resolved_by()
embed.description = f"**Type:** {str.title(moderation.moderation_type)}\n**Target:** {target.name} ({target.id})\n**Moderator:** {moderator.name} ({moderator.id})\n**Timestamp:** <t:{moderation.unix_timestamp}> | <t:{moderation.unix_timestamp}:R>" embed.description = f"**Type:** {str.title(moderation.type.string)}\n**Target:** {target.name} ({target.id})\n**Moderator:** {moderator.name} ({moderator.id})\n**Timestamp:** <t:{moderation.unix_timestamp}> | <t:{moderation.unix_timestamp}:R>"
if moderation.duration is not None: if moderation.duration is not None:
duration_embed = ( duration_embed = (
@ -146,7 +146,7 @@ async def log_factory(
title=f"📕 Case #{moderation.id:,}", title=f"📕 Case #{moderation.id:,}",
color=await ctx.bot.get_embed_color(ctx.channel), color=await ctx.bot.get_embed_color(ctx.channel),
) )
embed.description = f"**Type:** {str.title(moderation.type)}\n**Target:** {target.name} ({target.id})\n**Moderator:** {moderator.name} ({moderator.id})\n**Timestamp:** <t:{moderation.unix_timestamp}> | <t:{moderation.unix_timestamp}:R>" embed.description = f"**Type:** {str.title(moderation.type.string)}\n**Target:** {target.name} ({target.id})\n**Moderator:** {moderator.name} ({moderator.id})\n**Timestamp:** <t:{moderation.unix_timestamp}> | <t:{moderation.unix_timestamp}:R>"
if moderation.duration: if moderation.duration:
embed.description = ( embed.description = (
@ -176,7 +176,7 @@ async def case_factory(interaction: Interaction, moderation: Moderation) -> Embe
title=f"📕 Case #{moderation.id:,}", title=f"📕 Case #{moderation.id:,}",
color=await interaction.client.get_embed_color(interaction.channel), color=await interaction.client.get_embed_color(interaction.channel),
) )
embed.description = f"**Type:** {str.title(moderation.type)}\n**Target:** `{target.name}` ({target.id})\n**Moderator:** `{moderator.name}` ({moderator.id})\n**Resolved:** {moderation.resolved}\n**Timestamp:** <t:{moderation.unix_timestamp}> | <t:{moderation.unix_timestamp}:R>" embed.description = f"**Type:** {str.title(moderation.type.string)}\n**Target:** `{target.name}` ({target.id})\n**Moderator:** `{moderator.name}` ({moderator.id})\n**Resolved:** {moderation.resolved}\n**Timestamp:** <t:{moderation.unix_timestamp}> | <t:{moderation.unix_timestamp}:R>"
if moderation.duration: if moderation.duration:
duration_embed = ( duration_embed = (
@ -284,7 +284,7 @@ async def evidenceformat_factory(moderation: Moderation) -> str:
target = await moderation.get_target() target = await moderation.get_target()
moderator = await moderation.get_moderator() moderator = await moderation.get_moderator()
content = f"Case: {moderation.id:,} ({str.title(moderation.type)})\nTarget: {target.name} ({target.id})\nModerator: {moderator.name} ({moderator.id})" content = f"Case: {moderation.id:,} ({str.title(moderation.type.string)})\nTarget: {target.name} ({target.id})\nModerator: {moderator.name} ({moderator.id})"
if moderation.duration is not None: if moderation.duration is not None:
content += f"\nDuration: {humanize_timedelta(timedelta=moderation.duration)}" content += f"\nDuration: {humanize_timedelta(timedelta=moderation.duration)}"