Compare commits

..

No commits in common. "e2d2b7bdc19be44c29b3b941f4f2353bf8b123a8" and "918c058f5a7e24cbf9d4044d936eee88f159fee2" have entirely different histories.

View file

@ -182,11 +182,6 @@ class Aurora(commands.Cog):
@commands.hybrid_command(name="note") @commands.hybrid_command(name="note")
@commands.mod_or_permissions(moderate_members=True) @commands.mod_or_permissions(moderate_members=True)
@app_commands.describe(
target="Who are you noting?",
reason="Why are you noting this user?",
silent="Should the user be messaged?",
)
async def note( async def note(
self, self,
ctx: commands.Context, ctx: commands.Context,
@ -194,7 +189,16 @@ class Aurora(commands.Cog):
reason: str, reason: str,
silent: bool = None, silent: bool = None,
): ):
"""Add a note to a user.""" """Add a note to a user.
Parameters
-----------
target: discord.User
Who are you noting?
reason: str
Why are you noting this user?
silent: bool
Should the user be messaged?"""
if not await check_moddable(target, ctx, ["moderate_members"]): if not await check_moddable(target, ctx, ["moderate_members"]):
return return
@ -238,11 +242,6 @@ class Aurora(commands.Cog):
@commands.hybrid_command(name="warn") @commands.hybrid_command(name="warn")
@commands.mod_or_permissions(moderate_members=True) @commands.mod_or_permissions(moderate_members=True)
@app_commands.describe(
target="Who are you warning?",
reason="Why are you warning this user?",
silent="Should the user be messaged?",
)
async def warn( async def warn(
self, self,
ctx: commands.Context, ctx: commands.Context,
@ -250,7 +249,16 @@ class Aurora(commands.Cog):
reason: str, reason: str,
silent: bool = None, silent: bool = None,
): ):
"""Warn a user.""" """Warn a user.
Parameters
-----------
target: discord.Member
Who are you warning?
reason: str
Why are you warning this user?
silent: bool
Should the user be messaged?"""
if not await check_moddable(target, ctx, ["moderate_members"]): if not await check_moddable(target, ctx, ["moderate_members"]):
return return
@ -401,28 +409,32 @@ class Aurora(commands.Cog):
case = await fetch_case(moderation_id, interaction.guild.id) case = await fetch_case(moderation_id, interaction.guild.id)
await send_evidenceformat(interaction, case) await send_evidenceformat(interaction, case)
@commands.hybrid_command(name="mute") @app_commands.command(name="mute")
@commands.mod_or_permissions(moderate_members=True)
@app_commands.describe(
target="Who are you muting?",
duration="How long are you muting this user for?",
reason="Why are you muting this user?",
silent="Should the user be messaged?",
)
async def mute( async def mute(
self, self,
ctx: commands.Context, interaction: discord.Interaction,
target: discord.Member, target: discord.Member,
duration: str, duration: str,
reason: str, reason: str,
silent: bool = None, silent: bool = None,
): ):
"""Mute a user.""" """Mute a user.
if not await check_moddable(target, ctx, ["moderate_members"]):
Parameters
-----------
target: discord.Member
Who are you unbanning?
duration: str
How long are you muting this user for?
reason: str
Why are you unbanning this user?
silent: bool
Should the user be messaged?"""
if not await check_moddable(target, interaction, ["moderate_members"]):
return return
if target.is_timed_out() is True: if target.is_timed_out() is True:
await ctx.send( await interaction.response.send_message(
error(f"{target.mention} is already muted!"), error(f"{target.mention} is already muted!"),
allowed_mentions=discord.AllowedMentions(users=False), allowed_mentions=discord.AllowedMentions(users=False),
ephemeral=True, ephemeral=True,
@ -432,36 +444,36 @@ class Aurora(commands.Cog):
try: try:
parsed_time = parse(sval=duration, as_timedelta=True, raise_exception=True) parsed_time = parse(sval=duration, as_timedelta=True, raise_exception=True)
except ValueError: except ValueError:
await ctx.send( await interaction.response.send_message(
error("Please provide a valid duration!"), ephemeral=True error("Please provide a valid duration!"), ephemeral=True
) )
return return
if parsed_time.total_seconds() / 1000 > 2419200000: if parsed_time.total_seconds() / 1000 > 2419200000:
await ctx.send( await interaction.response.send_message(
error("Please provide a duration that is less than 28 days.") error("Please provide a duration that is less than 28 days.")
) )
return return
await target.timeout( await target.timeout(
parsed_time, reason=f"Muted by {ctx.author.id} for: {reason}" parsed_time, reason=f"Muted by {interaction.user.id} for: {reason}"
) )
message = await ctx.send( await interaction.response.send_message(
content=f"{target.mention} has been muted for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`" content=f"{target.mention} has been muted for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`"
) )
if silent is None: if silent is None:
silent = not await config.guild(ctx.guild).dm_users() silent = not await config.guild(interaction.guild).dm_users()
if silent is False: if silent is False:
try: try:
embed = await message_factory( embed = await message_factory(
await ctx.embed_color(), await self.bot.get_embed_color(interaction.channel),
guild=ctx.guild, guild=interaction.guild,
moderator=ctx.author, moderator=interaction.user,
reason=reason, reason=reason,
moderation_type="muted", moderation_type="muted",
response=message, response=await interaction.original_response(),
duration=parsed_time, duration=parsed_time,
) )
await target.send(embed=embed) await target.send(embed=embed)
@ -469,8 +481,8 @@ class Aurora(commands.Cog):
pass pass
moderation_id = await mysql_log( moderation_id = await mysql_log(
ctx.guild.id, interaction.guild.id,
ctx.author.id, interaction.user.id,
"MUTE", "MUTE",
"USER", "USER",
target.id, target.id,
@ -478,13 +490,13 @@ class Aurora(commands.Cog):
parsed_time, parsed_time,
reason, reason,
) )
await message.edit( await interaction.edit_original_response(
content=f"{target.mention} has been muted for {humanize.precisedelta(parsed_time)}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`" content=f"{target.mention} has been muted for {humanize.precisedelta(parsed_time)}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`"
) )
await log(ctx, moderation_id) await log(interaction, moderation_id)
case = await fetch_case(moderation_id, ctx.guild.id) case = await fetch_case(moderation_id, interaction.guild.id)
await send_evidenceformat(ctx, case) await send_evidenceformat(interaction, case)
@app_commands.command(name="unmute") @app_commands.command(name="unmute")
async def unmute( async def unmute(