WIP: Moderation type registry #26

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

View file

@ -20,8 +20,7 @@ from redbot.core import app_commands, commands, data_manager
from redbot.core.app_commands import Choice from redbot.core.app_commands import Choice
from redbot.core.bot import Red from redbot.core.bot import Red
from redbot.core.commands.converter import parse_relativedelta, parse_timedelta from redbot.core.commands.converter import parse_relativedelta, parse_timedelta
from redbot.core.utils.chat_formatting import (box, error, humanize_list, from redbot.core.utils.chat_formatting import box, error, humanize_list, humanize_timedelta, warning
humanize_timedelta, warning)
from aurora.importers.aurora import ImportAuroraView from aurora.importers.aurora import ImportAuroraView
from aurora.importers.galacticbot import ImportGalacticBotView from aurora.importers.galacticbot import ImportGalacticBotView
@ -32,17 +31,10 @@ from aurora.menus.overrides import Overrides
from aurora.models import Change, Moderation from aurora.models import Change, Moderation
from aurora.utilities.config import config, register_config from aurora.utilities.config import config, register_config
from aurora.utilities.database import connect, create_guild_table from aurora.utilities.database import connect, create_guild_table
from aurora.utilities.factory import (addrole_embed, case_factory, from aurora.utilities.factory import addrole_embed, case_factory, changes_factory, evidenceformat_factory, guild_embed, immune_embed, message_factory, overrides_embed
changes_factory, evidenceformat_factory,
guild_embed, immune_embed,
message_factory, overrides_embed)
from aurora.utilities.json import dump from aurora.utilities.json import dump
from aurora.utilities.logger import logger from aurora.utilities.logger import logger
from aurora.utilities.utils import (check_moddable, check_permissions, from aurora.utilities.utils import check_moddable, check_permissions, get_footer_image, log, send_evidenceformat, timedelta_from_relativedelta
get_footer_image, log, send_evidenceformat,
timedelta_from_relativedelta)
class Aurora(commands.Cog): class Aurora(commands.Cog):
"""Aurora is a fully-featured moderation system. """Aurora is a fully-featured moderation system.
@ -1145,10 +1137,10 @@ class Aurora(commands.Cog):
}) })
moderator = memory_dict[str(mod.moderator_id)] moderator = memory_dict[str(mod.moderator_id)]
field_name = f"Case #{case['moderation_id']:,} ({str.title(case['moderation_type'])})" field_name = f"Case #{mod.id:,} ({str.title(mod.type)})"
field_value = f"**Target:** `{target.name}` ({target.id})\n**Moderator:** `{moderator.name}` ({moderator.id})" field_value = f"**Target:** `{target.name}` ({target.id})\n**Moderator:** `{moderator.name}` ({moderator.id})"
if len(case["reason"]) > 125: if len(mod.reason) > 125:
field_value += f"\n**Reason:** `{str(mod.reason)[:125]}...`" field_value += f"\n**Reason:** `{str(mod.reason)[:125]}...`"
else: else:
field_value += f"\n**Reason:** `{str(mod.reason)}`" field_value += f"\n**Reason:** `{str(mod.reason)}`"