forked from cswimr/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)
|
case = await fetch_case(moderation_id, ctx.guild.id)
|
||||||
await send_evidenceformat(ctx, case)
|
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(
|
async def warn(
|
||||||
self,
|
self,
|
||||||
interaction: discord.Interaction,
|
ctx: commands.Context,
|
||||||
target: discord.Member,
|
target: discord.Member,
|
||||||
reason: str,
|
reason: str,
|
||||||
silent: bool = None,
|
silent: bool = None,
|
||||||
|
@ -258,32 +259,32 @@ class Aurora(commands.Cog):
|
||||||
Why are you warning this user?
|
Why are you warning this user?
|
||||||
silent: bool
|
silent: bool
|
||||||
Should the user be messaged?"""
|
Should the user be messaged?"""
|
||||||
if not await check_moddable(target, interaction, ["moderate_members"]):
|
if not await check_moddable(target, ctx, ["moderate_members"]):
|
||||||
return
|
return
|
||||||
|
|
||||||
await interaction.response.send_message(
|
message = await ctx.send(
|
||||||
content=f"{target.mention} has been warned!\n**Reason** - `{reason}`"
|
content=f"{target.mention} has been warned!\n**Reason** - `{reason}`"
|
||||||
)
|
)
|
||||||
|
|
||||||
if silent is None:
|
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:
|
if silent is False:
|
||||||
try:
|
try:
|
||||||
embed = await message_factory(
|
embed = await message_factory(
|
||||||
await self.bot.get_embed_color(interaction.channel),
|
await self.bot.get_embed_color(ctx.channel),
|
||||||
guild=interaction.guild,
|
guild=ctx.guild,
|
||||||
moderator=interaction.user,
|
moderator=ctx.author,
|
||||||
reason=reason,
|
reason=reason,
|
||||||
moderation_type="warned",
|
moderation_type="warned",
|
||||||
response=await interaction.original_response(),
|
response=message,
|
||||||
)
|
)
|
||||||
await target.send(embed=embed)
|
await target.send(embed=embed)
|
||||||
except discord.errors.HTTPException:
|
except discord.errors.HTTPException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
moderation_id = await mysql_log(
|
moderation_id = await mysql_log(
|
||||||
interaction.guild.id,
|
ctx.guild.id,
|
||||||
interaction.user.id,
|
ctx.author.id,
|
||||||
"WARN",
|
"WARN",
|
||||||
"USER",
|
"USER",
|
||||||
target.id,
|
target.id,
|
||||||
|
@ -291,13 +292,13 @@ class Aurora(commands.Cog):
|
||||||
"NULL",
|
"NULL",
|
||||||
reason,
|
reason,
|
||||||
)
|
)
|
||||||
await interaction.edit_original_response(
|
await message.edit(
|
||||||
content=f"{target.mention} has been warned! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`"
|
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)
|
case = await fetch_case(moderation_id, ctx.guild.id)
|
||||||
await send_evidenceformat(interaction, case)
|
await send_evidenceformat(ctx, case)
|
||||||
|
|
||||||
@app_commands.command(name="addrole")
|
@app_commands.command(name="addrole")
|
||||||
async def addrole(
|
async def addrole(
|
||||||
|
|
Loading…
Reference in a new issue