fix: hopefully actually fixed shortmute command this time

This commit is contained in:
Seaswimmer 2023-08-08 01:26:43 -04:00
parent a6368dd715
commit 7b671851a2
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -37,7 +37,8 @@ class Shortmute(commands.Cog):
"target": target,
"duration": duration,
"reason": reason,
"interaction": interaction
"interaction": interaction,
"color": await self.bot.get_embed_color(None)
}
if evidence_image and evidence_link:
await interaction.response.send_message(content="You've provided both the `evidence_image` and the `evidence_link` arguments! Please only use one or the other.", ephemeral=True)
@ -91,16 +92,17 @@ class Shortmute(commands.Cog):
readable_duration = self.passed_info['readable_duration']
reason = self.passed_info['reason']
old_interaction = self.passed_info['interaction']
color = self.passed_info['color']
timedelta = parse(f'{duration} minutes')
edit_embed = discord.Embed(title="Shortmute confirmed!", description=f"Moderator: {old_interaction.user.mention}\nTarget: {target.mention}\nDuration: {readable_duration}\nReason: `{reason}`", color=await self.bot.get_embed_color(None))
edit_embed = discord.Embed(title="Shortmute confirmed!", description=f"Moderator: {old_interaction.user.mention}\nTarget: {target.mention}\nDuration: {readable_duration}\nReason: `{reason}`", color=color)
if self.passed_info.get('evidence'):
evidence = self.passed_info['evidence']
edit_embed.set_image(url=evidence)
old_message = await interaction.response.edit_message(embed=edit_embed, view=None)
old_message = await old_interaction.edit_original_response(embed=edit_embed, view=None)
await target.timeout(until=timedelta, reason=f"User shortmuted for {readable_duration} by {old_interaction.user.name} ({old_interaction.user.id}) for: {reason}")
await interaction.channel.send(content=f"{target.mention} shortmuted for {readable_duration} by {old_interaction.user.mention} for: `{reason}`")
if await self.config.guild(old_interaction.guild).dm() is True:
dm_embed = discord.Embed(title=f"You've been shortmuted in {old_interaction.guild.name}!", description=f"Moderator: {old_interaction.user.mention}\nTarget: {target.mention}\nDuration: {readable_duration}\nReason: `{reason}`", color=await self.bot.get_embed_color(None))
dm_embed = discord.Embed(title=f"You've been shortmuted in {old_interaction.guild.name}!", description=f"Moderator: {old_interaction.user.mention}\nTarget: {target.mention}\nDuration: {readable_duration}\nReason: `{reason}`", color=color)
if evidence:
dm_embed.set_image(url=evidence)
try:
@ -109,7 +111,7 @@ class Shortmute(commands.Cog):
await old_message.edit(content="Could not message the target, user most likely has Direct Messages disabled.")
logging_channels_list = await self.config.guild(old_interaction.guild).logging_channels()
if logging_channels_list:
logging_embed = discord.Embed(title="Shortmute", description=f"Moderator: {old_interaction.user.mention} ({old_interaction.user.id})\nTarget: {target.mention} ({target.id})\nDuration: {readable_duration}\nReason: `{reason}`", color=await self.bot.get_embed_color(None))
logging_embed = discord.Embed(title="Shortmute", description=f"Moderator: {old_interaction.user.mention} ({old_interaction.user.id})\nTarget: {target.mention} ({target.id})\nDuration: {readable_duration}\nReason: `{reason}`", color=color)
if evidence:
logging_embed.set_image(url=evidence)
for channel_id in logging_channels_list: