fix(moderation): more pylint fixes!
Some checks failed
Pylint / Pylint (3.10) (push) Has been cancelled
Some checks failed
Pylint / Pylint (3.10) (push) Has been cancelled
This commit is contained in:
parent
4302f33a9e
commit
e38e68ecb5
3 changed files with 14 additions and 14 deletions
|
@ -8,7 +8,7 @@ async def embed_factory(embed_type: str, color: Color, /, interaction: Interact
|
|||
|
||||
Valid arguments for 'embed_type':
|
||||
- 'message'
|
||||
- 'log' - WIP
|
||||
- 'log'
|
||||
- 'case'
|
||||
- 'changes'
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ class Moderation(commands.Cog):
|
|||
|
||||
moderation_id = await mysql_log(interaction.guild.id, interaction.user.id, 'NOTE', target.id, 0, 'NULL', reason)
|
||||
await interaction.edit_original_response(content=f"{target.mention} has received a note! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`")
|
||||
await log(interaction, moderation_id, await self.bot.get_embed_color(None))
|
||||
await log(interaction, moderation_id)
|
||||
|
||||
@app_commands.command(name="warn")
|
||||
async def warn(self, interaction: discord.Interaction, target: discord.Member, reason: str, silent: bool = None):
|
||||
|
@ -234,7 +234,7 @@ class Moderation(commands.Cog):
|
|||
|
||||
moderation_id = await mysql_log(interaction.guild.id, interaction.user.id, 'WARN', target.id, 0, 'NULL', reason)
|
||||
await interaction.edit_original_response(content=f"{target.mention} has been warned! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`")
|
||||
await log(interaction, moderation_id, await self.bot.get_embed_color(None))
|
||||
await log(interaction, moderation_id)
|
||||
|
||||
async def blacklist_autocomplete(self, interaction: discord.Interaction, current: str,) -> list[app_commands.Choice[str]]: # pylint: disable=unused-argument
|
||||
"""Autocompletes a blacklist role."""
|
||||
|
@ -298,7 +298,7 @@ class Moderation(commands.Cog):
|
|||
|
||||
moderation_id = await mysql_log(interaction.guild.id, interaction.user.id, 'BLACKLIST', target.id, role, matching_role['duration'], reason)
|
||||
await interaction.edit_original_response(content=f"{target.mention} has been blacklisted with the {role_obj.name} role for {humanize.precisedelta(matching_role['duration'])}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`")
|
||||
await log(interaction, moderation_id, await self.bot.get_embed_color(None))
|
||||
await log(interaction, moderation_id)
|
||||
|
||||
@app_commands.command(name="mute")
|
||||
async def mute(self, interaction: discord.Interaction, target: discord.Member, duration: str, reason: str, silent: bool = None):
|
||||
|
@ -346,7 +346,7 @@ class Moderation(commands.Cog):
|
|||
|
||||
moderation_id = await mysql_log(interaction.guild.id, interaction.user.id, 'MUTE', target.id, 0, parsed_time, reason)
|
||||
await interaction.edit_original_response(content=f"{target.mention} has been muted for {humanize.precisedelta(parsed_time)}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`")
|
||||
await log(interaction, moderation_id, await self.bot.get_embed_color(None))
|
||||
await log(interaction, moderation_id)
|
||||
|
||||
@app_commands.command(name="unmute")
|
||||
async def unmute(self, interaction: discord.Interaction, target: discord.Member, reason: str = None, silent: bool = None):
|
||||
|
@ -386,7 +386,7 @@ class Moderation(commands.Cog):
|
|||
|
||||
moderation_id = await mysql_log(interaction.guild.id, interaction.user.id, 'UNMUTE', target.id, 0, 'NULL', reason)
|
||||
await interaction.edit_original_response(content=f"{target.mention} has been unmuted! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`")
|
||||
await log(interaction, moderation_id, await self.bot.get_embed_color(None))
|
||||
await log(interaction, moderation_id)
|
||||
|
||||
@app_commands.command(name="kick")
|
||||
async def kick(self, interaction: discord.Interaction, target: discord.Member, reason: str, silent: bool = None):
|
||||
|
@ -418,7 +418,7 @@ class Moderation(commands.Cog):
|
|||
|
||||
moderation_id = await mysql_log(interaction.guild.id, interaction.user.id, 'KICK', target.id, 0, 'NULL', reason)
|
||||
await interaction.edit_original_response(content=f"{target.mention} has been kicked! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`")
|
||||
await log(interaction, moderation_id, await self.bot.get_embed_color(None))
|
||||
await log(interaction, moderation_id)
|
||||
|
||||
@app_commands.command(name="ban")
|
||||
@app_commands.choices(delete_messages=[
|
||||
|
@ -473,7 +473,7 @@ class Moderation(commands.Cog):
|
|||
|
||||
moderation_id = await mysql_log(interaction.guild.id, interaction.user.id, 'TEMPBAN', target.id, 0, parsed_time, reason)
|
||||
await interaction.edit_original_response(content=f"{target.mention} has been banned for {humanize.precisedelta(parsed_time)}! (Case `#{moderation_id}`)\n**Reason** - `{reason}`")
|
||||
await log(interaction, moderation_id, await self.bot.get_embed_color(None))
|
||||
await log(interaction, moderation_id)
|
||||
else:
|
||||
await interaction.response.send_message(content=f"{target.mention} has been banned!\n**Reason** - `{reason}`")
|
||||
|
||||
|
@ -532,7 +532,7 @@ class Moderation(commands.Cog):
|
|||
|
||||
moderation_id = await mysql_log(interaction.guild.id, interaction.user.id, 'UNBAN', target.id, 0, 'NULL', reason)
|
||||
await interaction.edit_original_response(content=f"{target.mention} has been unbanned! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`")
|
||||
await log(interaction, moderation_id, await self.bot.get_embed_color(None))
|
||||
await log(interaction, moderation_id)
|
||||
|
||||
@app_commands.command(name="history")
|
||||
async def history(self, interaction: discord.Interaction, target: discord.User = None, moderator: discord.User = None, pagesize: app_commands.Range[int, 1, 20] = None, page: int = 1, ephemeral: bool = None, inline: bool = None, export: bool = False):
|
||||
|
@ -764,7 +764,7 @@ class Moderation(commands.Cog):
|
|||
|
||||
embed = await embed_factory('case', await self.bot.get_embed_color(None), interaction=interaction, case_dict=await self.fetch_case(case, interaction.guild.id))
|
||||
await interaction.response.send_message(content=f"✅ Moderation #{case:,} resolved!", embed=embed)
|
||||
await log(interaction, case, await self.bot.get_embed_color(None), True)
|
||||
await log(interaction, case)
|
||||
|
||||
cursor.close()
|
||||
database.close()
|
||||
|
@ -926,7 +926,7 @@ class Moderation(commands.Cog):
|
|||
embed = await embed_factory('case', await self.bot.get_embed_color(None), interaction=interaction, case_dict=new_case)
|
||||
|
||||
await interaction.response.send_message(content=f"✅ Moderation #{case:,} edited!", embed=embed, ephemeral=True)
|
||||
await log(interaction, case, await self.bot.get_embed_color(None))
|
||||
await log(interaction, case)
|
||||
|
||||
cursor.close()
|
||||
database.close()
|
||||
|
@ -963,7 +963,7 @@ class Moderation(commands.Cog):
|
|||
try:
|
||||
await guild.unban(user, reason=f"Automatic unban from case #{moderation_id}")
|
||||
|
||||
embed = await embed_factory('message', guild, f'Automatic unban from case #{moderation_id}', 'unbanned')
|
||||
embed = await embed_factory('message', self.bot.get_embed_color(None), guild, f'Automatic unban from case #{moderation_id}', 'unbanned')
|
||||
|
||||
try:
|
||||
await user.send(embed=embed)
|
||||
|
|
|
@ -180,7 +180,7 @@ async def fetch_role_dict(interaction: Interaction, role_id: str):
|
|||
return role_dict
|
||||
|
||||
|
||||
async def log(interaction: Interaction, moderation_id: int, color: Color, resolved: bool = False):
|
||||
async def log(interaction: Interaction, moderation_id: int, resolved: bool = False):
|
||||
"""This method sends a message to the guild's configured logging channel when an infraction takes place."""
|
||||
from .embed_factory import embed_factory
|
||||
|
||||
|
@ -191,7 +191,7 @@ async def log(interaction: Interaction, moderation_id: int, color: Color, resolv
|
|||
case = await fetch_case(moderation_id, interaction.guild.id)
|
||||
if case:
|
||||
embed = await embed_factory(
|
||||
"log", color, interaction=interaction, case_dict=case, resolved=resolved
|
||||
"log", interaction.client.get_embed_color(None), interaction=interaction, case_dict=case, resolved=resolved
|
||||
)
|
||||
try:
|
||||
await logging_channel.send(embed=embed)
|
||||
|
|
Loading…
Reference in a new issue