feat(moderation): added case numbers to the moderation response messages
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 52s
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 52s
This commit is contained in:
parent
f9a9f07b39
commit
a0b77d6fcf
1 changed files with 16 additions and 8 deletions
|
@ -439,7 +439,7 @@ class Moderation(commands.Cog):
|
||||||
if interaction.user.top_role <= target_member.top_role:
|
if interaction.user.top_role <= target_member.top_role:
|
||||||
await interaction.response.send_message(content="You cannot moderate members with a higher role than you!", ephemeral=True)
|
await interaction.response.send_message(content="You cannot moderate members with a higher role than you!", ephemeral=True)
|
||||||
return
|
return
|
||||||
await interaction.response.send_message(content=f"{target.mention} has been warned!\n**Reason** - `{reason}`")
|
message: discord.Message = await interaction.response.send_message(content=f"{target.mention} has been warned!\n**Reason** - `{reason}`")
|
||||||
if silent is None:
|
if silent is None:
|
||||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||||
if silent is False:
|
if silent is False:
|
||||||
|
@ -449,6 +449,7 @@ class Moderation(commands.Cog):
|
||||||
except discord.errors.HTTPException:
|
except discord.errors.HTTPException:
|
||||||
pass
|
pass
|
||||||
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'WARN', target.id, 0, 'NULL', reason)
|
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'WARN', target.id, 0, 'NULL', reason)
|
||||||
|
await message.edit(content=f"{target.mention} has been warned! (Case `#{moderation_id}`)\n**Reason** - `{reason}`")
|
||||||
await self.log(interaction, moderation_id)
|
await self.log(interaction, moderation_id)
|
||||||
|
|
||||||
@app_commands.command(name="mute")
|
@app_commands.command(name="mute")
|
||||||
|
@ -489,7 +490,7 @@ class Moderation(commands.Cog):
|
||||||
await interaction.response.send_message("Please provide a duration that is less than 28 days.")
|
await interaction.response.send_message("Please provide a duration that is less than 28 days.")
|
||||||
return
|
return
|
||||||
await target.timeout(parsed_time, reason=f"Muted by {interaction.user.id} for: {reason}")
|
await target.timeout(parsed_time, reason=f"Muted by {interaction.user.id} for: {reason}")
|
||||||
await interaction.response.send_message(content=f"{target.mention} has been muted for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`")
|
message: discord.Message = await interaction.response.send_message(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 self.config.guild(interaction.guild).dm_users()
|
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||||
if silent is False:
|
if silent is False:
|
||||||
|
@ -499,6 +500,7 @@ class Moderation(commands.Cog):
|
||||||
except discord.errors.HTTPException:
|
except discord.errors.HTTPException:
|
||||||
pass
|
pass
|
||||||
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'MUTE', target.id, 0, parsed_time, reason)
|
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'MUTE', target.id, 0, parsed_time, reason)
|
||||||
|
await message.edit(content=f"{target.mention} has been muted for {humanize.precisedelta(parsed_time)}! (Case `#{moderation_id})\n**Reason** - `{reason}`")
|
||||||
await self.log(interaction, moderation_id)
|
await self.log(interaction, moderation_id)
|
||||||
|
|
||||||
@app_commands.command(name="unmute")
|
@app_commands.command(name="unmute")
|
||||||
|
@ -533,7 +535,7 @@ class Moderation(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await target.timeout(None, reason=f"Unbanned by {interaction.user.id}")
|
await target.timeout(None, reason=f"Unbanned by {interaction.user.id}")
|
||||||
reason = "No reason given."
|
reason = "No reason given."
|
||||||
await interaction.response.send_message(content=f"{target.mention} has been unmuted!\n**Reason** - `{reason}`")
|
message: discord.Message = await interaction.response.send_message(content=f"{target.mention} has been unmuted!\n**Reason** - `{reason}`")
|
||||||
if silent is None:
|
if silent is None:
|
||||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||||
if silent is False:
|
if silent is False:
|
||||||
|
@ -543,6 +545,7 @@ class Moderation(commands.Cog):
|
||||||
except discord.errors.HTTPException:
|
except discord.errors.HTTPException:
|
||||||
pass
|
pass
|
||||||
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'UNMUTE', target.id, 0, 'NULL', reason)
|
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'UNMUTE', target.id, 0, 'NULL', reason)
|
||||||
|
await message.edit(content=f"{target.mention} has been unmuted! (Case `#{moderation_id}`)\n**Reason** - `{reason}`")
|
||||||
await self.log(interaction, moderation_id)
|
await self.log(interaction, moderation_id)
|
||||||
|
|
||||||
@app_commands.command(name="kick")
|
@app_commands.command(name="kick")
|
||||||
|
@ -569,7 +572,7 @@ class Moderation(commands.Cog):
|
||||||
if permissions:
|
if permissions:
|
||||||
await interaction.response.send_message(f"I do not have the `{permissions}` permission, required for this action.", ephemeral=True)
|
await interaction.response.send_message(f"I do not have the `{permissions}` permission, required for this action.", ephemeral=True)
|
||||||
return
|
return
|
||||||
await interaction.response.send_message(content=f"{target.mention} has been kicked!\n**Reason** - `{reason}`")
|
message: discord.Message = await interaction.response.send_message(content=f"{target.mention} has been kicked!\n**Reason** - `{reason}`")
|
||||||
if silent is None:
|
if silent is None:
|
||||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||||
if silent is False:
|
if silent is False:
|
||||||
|
@ -580,6 +583,7 @@ class Moderation(commands.Cog):
|
||||||
pass
|
pass
|
||||||
await target.kick(f"Kicked by {interaction.user.id} for: {reason}")
|
await target.kick(f"Kicked by {interaction.user.id} for: {reason}")
|
||||||
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'KICK', target.id, 0, 'NULL', reason)
|
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'KICK', target.id, 0, 'NULL', reason)
|
||||||
|
await message.edit(content=f"{target.mention} has been kicked! (Case `#{moderation_id}`)\n**Reason** - `{reason}`")
|
||||||
await self.log(interaction, moderation_id)
|
await self.log(interaction, moderation_id)
|
||||||
|
|
||||||
@app_commands.command(name="ban")
|
@app_commands.command(name="ban")
|
||||||
|
@ -630,16 +634,18 @@ class Moderation(commands.Cog):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
await interaction.response.send_message("Please provide a valid duration!", ephemeral=True)
|
await interaction.response.send_message("Please provide a valid duration!", ephemeral=True)
|
||||||
return
|
return
|
||||||
await interaction.response.send_message(content=f"{target.mention} has been banned for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`")
|
message: discord.Message = await interaction.response.send_message(content=f"{target.mention} has been banned for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`")
|
||||||
try:
|
try:
|
||||||
embed = await self.embed_factory('message', guild=interaction.guild, reason=reason, moderation_type='tempbanned', response=await interaction.original_response(), duration=parsed_time)
|
embed = await self.embed_factory('message', guild=interaction.guild, reason=reason, moderation_type='tempbanned', response=await interaction.original_response(), duration=parsed_time)
|
||||||
await target.send(embed=embed)
|
await target.send(embed=embed)
|
||||||
except discord.errors.HTTPException:
|
except discord.errors.HTTPException:
|
||||||
pass
|
pass
|
||||||
await interaction.guild.ban(target, reason=f"Tempbanned by {interaction.user.id} for: {reason} (Duration: {parsed_time})", delete_message_seconds=delete_messages)
|
await interaction.guild.ban(target, reason=f"Tempbanned by {interaction.user.id} for: {reason} (Duration: {parsed_time})", delete_message_seconds=delete_messages)
|
||||||
await self.mysql_log(interaction.guild.id, interaction.user.id, 'TEMPBAN', target.id, 0, parsed_time, reason)
|
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'TEMPBAN', target.id, 0, parsed_time, reason)
|
||||||
|
await message.edit(content=f"{target.mention} has been banned for {humanize.precisedelta(parsed_time)}! (Case `#{moderation_id}`)\n**Reason** - `{reason}`")
|
||||||
|
await self.log(interaction, moderation_id)
|
||||||
else:
|
else:
|
||||||
await interaction.response.send_message(content=f"{target.mention} has been banned!\n**Reason** - `{reason}`")
|
message: discord.Message = await interaction.response.send_message(content=f"{target.mention} has been banned!\n**Reason** - `{reason}`")
|
||||||
if silent is None:
|
if silent is None:
|
||||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||||
if silent is False:
|
if silent is False:
|
||||||
|
@ -650,6 +656,7 @@ class Moderation(commands.Cog):
|
||||||
pass
|
pass
|
||||||
await interaction.guild.ban(target, reason=f"Banned by {interaction.user.id} for: {reason}", delete_message_seconds=delete_messages)
|
await interaction.guild.ban(target, reason=f"Banned by {interaction.user.id} for: {reason}", delete_message_seconds=delete_messages)
|
||||||
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'BAN', target.id, 0, 'NULL', reason)
|
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'BAN', target.id, 0, 'NULL', reason)
|
||||||
|
await message.edit(content=f"{target.mention} has been banned! (Case `#{moderation_id}`)\n**Reason** - `{reason}`")
|
||||||
await self.log(interaction, moderation_id)
|
await self.log(interaction, moderation_id)
|
||||||
|
|
||||||
@app_commands.command(name="unban")
|
@app_commands.command(name="unban")
|
||||||
|
@ -686,7 +693,7 @@ class Moderation(commands.Cog):
|
||||||
else:
|
else:
|
||||||
await interaction.guild.unban(target, reason=f"Unbanned by {interaction.user.id}")
|
await interaction.guild.unban(target, reason=f"Unbanned by {interaction.user.id}")
|
||||||
reason = "No reason given."
|
reason = "No reason given."
|
||||||
await interaction.response.send_message(content=f"{target.mention} has been unbanned!\n**Reason** - `{reason}`")
|
message: discord.Message = await interaction.response.send_message(content=f"{target.mention} has been unbanned!\n**Reason** - `{reason}`")
|
||||||
if silent is None:
|
if silent is None:
|
||||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||||
if silent is False:
|
if silent is False:
|
||||||
|
@ -696,6 +703,7 @@ class Moderation(commands.Cog):
|
||||||
except discord.errors.HTTPException:
|
except discord.errors.HTTPException:
|
||||||
pass
|
pass
|
||||||
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'UNBAN', target.id, 0, 'NULL', reason)
|
moderation_id = await self.mysql_log(interaction.guild.id, interaction.user.id, 'UNBAN', target.id, 0, 'NULL', reason)
|
||||||
|
await message.edit(content=f"{target.mention} has been unbanned! (Case `#{moderation_id}`)\n**Reason** - `{reason}`")
|
||||||
await self.log(interaction, moderation_id)
|
await self.log(interaction, moderation_id)
|
||||||
|
|
||||||
@app_commands.command(name="history")
|
@app_commands.command(name="history")
|
||||||
|
|
Loading…
Reference in a new issue