From eaf08f2e08d1ce12f2a0e13a62c78ea8a63e912b Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Sat, 30 Dec 2023 17:20:23 -0500 Subject: [PATCH] feat(aurora): added `[p]auroraset showmoderator` command and relevant matching features --- aurora/aurora.py | 7 +++++++ aurora/utilities/config.py | 1 + aurora/utilities/embed_factory.py | 9 ++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/aurora/aurora.py b/aurora/aurora.py index 8fa72ee..7bb59d5 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -1289,6 +1289,13 @@ class Aurora(commands.Cog): await config.guild(ctx.guild).log_channel.set(" ") await ctx.send("Logging channel disabled.") + @auroraset.command(name="showmoderator") + @checks.admin() + async def auroraset_showmoderator(self, ctx: commands.Context): + """Toggle if the cog should show the moderator in the case embed when dming a user.""" + await config.guild(ctx.guild).show_moderator.set(not await config.guild(ctx.guild).show_moderator()) + await ctx.send(f"Show moderator setting set to {await config.guild(ctx.guild).show_moderator()}") + @auroraset.group(autohelp=True, name='import') @checks.admin() async def auroraset_import(self, ctx: commands.Context): diff --git a/aurora/utilities/config.py b/aurora/utilities/config.py index 05343d8..ee5f080 100644 --- a/aurora/utilities/config.py +++ b/aurora/utilities/config.py @@ -4,6 +4,7 @@ config: Config = Config.get_conf(None, identifier=481923957134912, cog_name="Aur def register_config(config_obj: Config): config_obj.register_guild( + show_moderator = True, use_discord_permissions = True, ignore_other_bots = True, dm_users = True, diff --git a/aurora/utilities/embed_factory.py b/aurora/utilities/embed_factory.py index 6a0c3ea..a80ff3f 100644 --- a/aurora/utilities/embed_factory.py +++ b/aurora/utilities/embed_factory.py @@ -5,6 +5,7 @@ from datetime import datetime, timedelta import humanize from discord import Color, Embed, Guild, Interaction, InteractionMessage +from .config import config from .utils import fetch_channel_dict, fetch_user_dict, get_next_case_number @@ -51,11 +52,17 @@ async def embed_factory(embed_type: str, color: Color, /, interaction: Interact embed_desc = "been" embed = Embed(title=str.title(moderation_type), description=f"You have {embed_desc} {moderation_type}{embed_duration} in {guild_name}.", color=color, timestamp=datetime.now()) - embed.add_field(name='Reason', value=f"`{reason}`") + + if await config.guild(guild).show_moderator(): + embed.add_field(name='Moderator', value=f"`{interaction.user.name} ({interaction.user.id})`", inline=False) + + embed.add_field(name='Reason', value=f"`{reason}`", inline=False) + if guild.icon.url is not None: embed.set_author(name=guild.name, icon_url=guild.icon.url) else: embed.set_author(name=guild.name) + embed.set_footer(text=f"Case #{await get_next_case_number(guild.id):,}", icon_url="https://cdn.discordapp.com/attachments/1070822161389994054/1159469476773904414/arrow-right-circle-icon-512x512-2p1e2aaw.png?ex=65312319&is=651eae19&hm=3cebdd28e805c13a79ec48ef87c32ca532ffa6b9ede2e48d0cf8e5e81f3a6818&") return embed