forked from blizzthewolf/SeaCogs
feat(aurora): converted warn to a hybrid command
This commit is contained in:
parent
16a37691b5
commit
918c058f5a
1 changed files with 16 additions and 15 deletions
|
@ -240,10 +240,11 @@ class Aurora(commands.Cog):
|
|||
case = await fetch_case(moderation_id, ctx.guild.id)
|
||||
await send_evidenceformat(ctx, case)
|
||||
|
||||
@app_commands.command(name="warn")
|
||||
@commands.hybrid_command(name="warn")
|
||||
@commands.mod_or_permissions(moderate_members=True)
|
||||
async def warn(
|
||||
self,
|
||||
interaction: discord.Interaction,
|
||||
ctx: commands.Context,
|
||||
target: discord.Member,
|
||||
reason: str,
|
||||
silent: bool = None,
|
||||
|
@ -258,32 +259,32 @@ class Aurora(commands.Cog):
|
|||
Why are you warning this user?
|
||||
silent: bool
|
||||
Should the user be messaged?"""
|
||||
if not await check_moddable(target, interaction, ["moderate_members"]):
|
||||
if not await check_moddable(target, ctx, ["moderate_members"]):
|
||||
return
|
||||
|
||||
await interaction.response.send_message(
|
||||
message = await ctx.send(
|
||||
content=f"{target.mention} has been warned!\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 self.bot.get_embed_color(ctx.channel),
|
||||
guild=ctx.guild,
|
||||
moderator=ctx.author,
|
||||
reason=reason,
|
||||
moderation_type="warned",
|
||||
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,
|
||||
"WARN",
|
||||
"USER",
|
||||
target.id,
|
||||
|
@ -291,13 +292,13 @@ class Aurora(commands.Cog):
|
|||
"NULL",
|
||||
reason,
|
||||
)
|
||||
await interaction.edit_original_response(
|
||||
await message.edit(
|
||||
content=f"{target.mention} has been warned! (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="addrole")
|
||||
async def addrole(
|
||||
|
|
Loading…
Reference in a new issue