fix(shortmute): fixed using incorrect context for fetching embed colors
Some checks failed
Pylint / Pylint (3.10) (push) Failing after 1m44s

This commit is contained in:
Seaswimmer 2024-01-29 15:12:43 -05:00
parent f7be30dcd8
commit 435cc2d72d
Signed by: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -37,7 +37,7 @@ class Shortmute(commands.Cog):
An image file used as evidence for the shortmute, do not use with evidence_link
skip_confirmation: bool = None
This allows you skip the confirmation prompt and immediately shortmute the user.
"""
"""
disable_dateutil()
timedelta = parse(f'{duration} minutes', as_timedelta=True)
if evidence_image and evidence_link:
@ -56,7 +56,7 @@ class Shortmute(commands.Cog):
"timedelta": timedelta,
"reason": reason,
"interaction": interaction,
"color": await self.bot.get_embed_color(None),
"color": await self.bot.get_embed_color(interaction.guild),
"evidence": evidence
}
blacklisted_users_list = await self.config.guild(interaction.guild).blacklisted_users()
@ -91,13 +91,13 @@ class Shortmute(commands.Cog):
await interaction.response.send_message(content=f"Please shortmute the user for longer than {readable_duration}! The maximum duration is 30 minutes.", ephemeral=True)
return
if skip_confirmation is False:
embed = discord.Embed(title="Are you sure?", description=f"**Moderator:** {interaction.user.mention}\n**Target:** {target.mention}\n**Duration:** {readable_duration}\n**Reason:** `{reason}`", color=await self.bot.get_embed_color(None))
embed = discord.Embed(title="Are you sure?", description=f"**Moderator:** {interaction.user.mention}\n**Target:** {target.mention}\n**Duration:** {readable_duration}\n**Reason:** `{reason}`", color=await self.bot.get_embed_color(interaction.guild))
embed.set_footer(text="/shortmute")
if evidence:
embed.set_image(url=evidence)
await interaction.response.send_message(embed=embed, view=self.ShortmuteButtons(timeout=180, passed_info=passed_info), ephemeral=True)
elif skip_confirmation is True:
edit_embed = discord.Embed(title="Shortmute confirmed!", description=f"**Moderator:** {interaction.user.mention}\n**Target:** {target.mention}\n**Duration:** {readable_duration}\n**Reason:** `{reason}`", color=await self.bot.get_embed_color(None))
edit_embed = discord.Embed(title="Shortmute confirmed!", description=f"**Moderator:** {interaction.user.mention}\n**Target:** {target.mention}\n**Duration:** {readable_duration}\n**Reason:** `{reason}`", color=await self.bot.get_embed_color(interaction.guild))
edit_embed.set_footer(text="/shortmute")
if evidence:
edit_embed.set_image(url=evidence)
@ -105,7 +105,7 @@ class Shortmute(commands.Cog):
await target.timeout(timedelta, reason=f"User shortmuted for {readable_duration} by {interaction.user.name} ({interaction.user.id}) for: {reason}")
shortmute_msg = await interaction.channel.send(content=f"{target.mention} was shortmuted for {readable_duration} by {interaction.user.mention} for: `{reason}`")
if await self.config.guild(interaction.guild).dm() is True:
dm_embed = discord.Embed(title=f"You've been shortmuted in {interaction.guild.name}!", description=f"**Moderator:** {interaction.user.mention}\n**Target:** {target.mention}\n**Message:** {shortmute_msg.jump_url}\n**Duration:** {readable_duration}\n**Reason:** `{reason}`", color=await self.bot.get_embed_color(None))
dm_embed = discord.Embed(title=f"You've been shortmuted in {interaction.guild.name}!", description=f"**Moderator:** {interaction.user.mention}\n**Target:** {target.mention}\n**Message:** {shortmute_msg.jump_url}\n**Duration:** {readable_duration}\n**Reason:** `{reason}`", color=await self.bot.get_embed_color(interaction.guild))
dm_embed.set_footer(text="/shortmute")
if evidence:
dm_embed.set_image(url=evidence)
@ -115,7 +115,7 @@ class Shortmute(commands.Cog):
await message.edit(content="Could not message the target, user most likely has Direct Messages disabled.")
logging_channels_list = await self.config.guild(interaction.guild).logging_channels()
if logging_channels_list:
logging_embed = discord.Embed(title="User Shortmuted", description=f"**Moderator:** {interaction.user.mention} ({interaction.user.id})\n**Target:** {target.mention} ({target.id})\n**Message:** {shortmute_msg.jump_url}\n**Duration:** {readable_duration}\n**Reason:** `{reason}`\n**Confirmation Skipped:** True", color=await self.bot.get_embed_color(None))
logging_embed = discord.Embed(title="User Shortmuted", description=f"**Moderator:** {interaction.user.mention} ({interaction.user.id})\n**Target:** {target.mention} ({target.id})\n**Message:** {shortmute_msg.jump_url}\n**Duration:** {readable_duration}\n**Reason:** `{reason}`\n**Confirmation Skipped:** True", color=await self.bot.get_embed_color(interaction.guild))
logging_embed.set_footer(text="/shortmute")
if evidence:
logging_embed.set_image(url=evidence)