WIP: Moderation type registry #26

Closed
cswimr wants to merge 146 commits from aurora-3rd-party into main
Showing only changes of commit e89db3de5a - Show all commits

View file

@ -2,17 +2,13 @@
from datetime import datetime, timedelta
from typing import Union
from discord import (Color, Embed, Guild, Interaction, InteractionMessage,
Member, Role, User)
from discord import Color, Embed, Guild, Interaction, InteractionMessage, Member, Role, User
from redbot.core import commands
from redbot.core.utils.chat_formatting import (bold, box, error,
humanize_timedelta, warning)
from redbot.core.utils.chat_formatting import bold, box, error, humanize_timedelta, warning
from aurora.models import Moderation, PartialUser
from aurora.utilities.config import config
from aurora.utilities.utils import (fetch_channel_dict, fetch_user_dict,
get_bool_emoji, get_next_case_number,
get_pagesize_str)
from aurora.utilities.utils import fetch_channel_dict, fetch_user_dict, get_bool_emoji, get_next_case_number, get_pagesize_str
async def message_factory(
@ -169,7 +165,7 @@ async def case_factory(interaction: Interaction, moderation: Moderation) -> Embe
title=f"📕 Case #{moderation.id:,}",
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)}\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:
duration_embed = (
@ -205,7 +201,7 @@ async def case_factory(interaction: Interaction, moderation: Moderation) -> Embe
resolved_user = await moderation.get_resolved_by()
embed.add_field(
name="Resolve Reason",
value=f"Resolved by {resolved_user.name} ({resolved_user.id}) for:\n{box(moderation.resolve_reason)}",
value=f"Resolved by `{resolved_user.name}` ({resolved_user.id}) for:\n{box(moderation.resolve_reason)}",
inline=False,
)