WIP: Make Aurora commands hybrid commands #17
1 changed files with 25 additions and 28 deletions
|
@ -486,29 +486,26 @@ class Aurora(commands.Cog):
|
|||
case = await fetch_case(moderation_id, ctx.guild.id)
|
||||
await send_evidenceformat(ctx, case)
|
||||
|
||||
@app_commands.command(name="unmute")
|
||||
@commands.hybrid_command(name="unmute")
|
||||
@commands.mod_or_permissions(moderate_members=True)
|
||||
@app_commands.describe(
|
||||
target="Who are you unmuting?",
|
||||
reason="Why are you unmuting this user?",
|
||||
silent="Should the user be messaged?",
|
||||
)
|
||||
async def unmute(
|
||||
self,
|
||||
interaction: discord.Interaction,
|
||||
ctx: commands.Context,
|
||||
target: discord.Member,
|
||||
reason: str = None,
|
||||
silent: bool = None,
|
||||
):
|
||||
"""Unmute a user.
|
||||
|
||||
Parameters
|
||||
-----------
|
||||
target: discord.user
|
||||
Who are you unmuting?
|
||||
reason: str
|
||||
Why are you unmuting this user?
|
||||
silent: bool
|
||||
Should the user be messaged?"""
|
||||
if not await check_moddable(target, interaction, ["moderate_members"]):
|
||||
"""Unmute a user."""
|
||||
if not await check_moddable(target, ctx, ["moderate_members"]):
|
||||
return
|
||||
|
||||
if target.is_timed_out() is False:
|
||||
await interaction.response.send_message(
|
||||
await ctx.send(
|
||||
error(f"{target.mention} is not muted!"),
|
||||
allowed_mentions=discord.AllowedMentions(users=False),
|
||||
ephemeral=True,
|
||||
|
@ -517,35 +514,35 @@ class Aurora(commands.Cog):
|
|||
|
||||
if reason:
|
||||
await target.timeout(
|
||||
None, reason=f"Unmuted by {interaction.user.id} for: {reason}"
|
||||
None, reason=f"Unmuted by {ctx.author.id} for: {reason}"
|
||||
)
|
||||
else:
|
||||
await target.timeout(None, reason=f"Unbanned by {interaction.user.id}")
|
||||
await target.timeout(None, reason=f"Unmuted by {ctx.author.id}")
|
||||
reason = "No reason given."
|
||||
|
||||
await interaction.response.send_message(
|
||||
message = await ctx.send(
|
||||
content=f"{target.mention} has been unmuted!\n**Reason** - `{reason}`"
|
||||
)
|
||||
|
||||
if silent is None:
|
||||
silent = not await config.guild(interaction.guild).dm_users()
|
||||
silent = not await config.guild(ctx.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await message_factory(
|
||||
await self.bot.get_embed_color(interaction.channel),
|
||||
guild=interaction.guild,
|
||||
moderator=interaction.user,
|
||||
await ctx.embed_color(),
|
||||
guild=ctx.guild,
|
||||
moderator=ctx.author,
|
||||
reason=reason,
|
||||
moderation_type="unmuted",
|
||||
response=await interaction.original_response(),
|
||||
response=message,
|
||||
)
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
pass
|
||||
|
||||
moderation_id = await mysql_log(
|
||||
interaction.guild.id,
|
||||
interaction.user.id,
|
||||
ctx.guild.id,
|
||||
ctx.author.id,
|
||||
"UNMUTE",
|
||||
"USER",
|
||||
target.id,
|
||||
|
@ -553,13 +550,13 @@ class Aurora(commands.Cog):
|
|||
"NULL",
|
||||
reason,
|
||||
)
|
||||
await interaction.edit_original_response(
|
||||
await message.edit(
|
||||
content=f"{target.mention} has been unmuted! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`"
|
||||
)
|
||||
await log(interaction, moderation_id)
|
||||
await log(ctx, moderation_id)
|
||||
|
||||
case = await fetch_case(moderation_id, interaction.guild.id)
|
||||
await send_evidenceformat(interaction, case)
|
||||
case = await fetch_case(moderation_id, ctx.guild.id)
|
||||
await send_evidenceformat(ctx, case)
|
||||
|
||||
@app_commands.command(name="kick")
|
||||
async def kick(
|
||||
|
|
Loading…
Reference in a new issue