feat(aurora): added [p]auroraset showmoderator command and relevant matching features

This commit is contained in:
Seaswimmer 2023-12-30 17:20:23 -05:00
parent f55dd00300
commit eaf08f2e08
3 changed files with 16 additions and 1 deletions

View file

@ -1289,6 +1289,13 @@ class Aurora(commands.Cog):
await config.guild(ctx.guild).log_channel.set(" ") await config.guild(ctx.guild).log_channel.set(" ")
await ctx.send("Logging channel disabled.") 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') @auroraset.group(autohelp=True, name='import')
@checks.admin() @checks.admin()
async def auroraset_import(self, ctx: commands.Context): async def auroraset_import(self, ctx: commands.Context):

View file

@ -4,6 +4,7 @@ config: Config = Config.get_conf(None, identifier=481923957134912, cog_name="Aur
def register_config(config_obj: Config): def register_config(config_obj: Config):
config_obj.register_guild( config_obj.register_guild(
show_moderator = True,
use_discord_permissions = True, use_discord_permissions = True,
ignore_other_bots = True, ignore_other_bots = True,
dm_users = True, dm_users = True,

View file

@ -5,6 +5,7 @@ from datetime import datetime, timedelta
import humanize import humanize
from discord import Color, Embed, Guild, Interaction, InteractionMessage 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 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_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 = 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: if guild.icon.url is not None:
embed.set_author(name=guild.name, icon_url=guild.icon.url) embed.set_author(name=guild.name, icon_url=guild.icon.url)
else: else:
embed.set_author(name=guild.name) 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&") 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 return embed