fix: fixed evidence checking in shortmute button

This commit is contained in:
Seaswimmer 2023-08-08 02:03:44 -04:00
parent f862affafc
commit 45c64a77e5
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -39,7 +39,6 @@ class Shortmute(commands.Cog):
timedelta = parse(f'{duration} minutes', as_timedelta=True) timedelta = parse(f'{duration} minutes', as_timedelta=True)
passed_info = { passed_info = {
"target": target, "target": target,
"duration": duration,
"timedelta": timedelta, "timedelta": timedelta,
"reason": reason, "reason": reason,
"interaction": interaction, "interaction": interaction,
@ -123,15 +122,14 @@ class Shortmute(commands.Cog):
async def shortmute_button_yes(self, button: ui.Button, interaction: discord.Interaction): async def shortmute_button_yes(self, button: ui.Button, interaction: discord.Interaction):
disable_dateutil() disable_dateutil()
target = self.passed_info['target'] target = self.passed_info['target']
duration = self.passed_info['duration']
readable_duration = self.passed_info['readable_duration'] readable_duration = self.passed_info['readable_duration']
reason = self.passed_info['reason'] reason = self.passed_info['reason']
old_interaction = self.passed_info['interaction'] old_interaction = self.passed_info['interaction']
color = self.passed_info['color'] color = self.passed_info['color']
timedelta = self.passed_info['timedelta'] timedelta = self.passed_info['timedelta']
evidence = self.passed_info['evidence']
edit_embed = discord.Embed(title="Shortmute confirmed!", description=f"**Moderator:** {old_interaction.user.mention}\n**Target:** {target.mention}\n**Duration:** {readable_duration}\n**Reason:** `{reason}`", color=color) edit_embed = discord.Embed(title="Shortmute confirmed!", description=f"**Moderator:** {old_interaction.user.mention}\n**Target:** {target.mention}\n**Duration:** {readable_duration}\n**Reason:** `{reason}`", color=color)
if self.passed_info.get('evidence'): if evidence:
evidence = self.passed_info['evidence']
edit_embed.set_image(url=evidence) edit_embed.set_image(url=evidence)
old_message = await old_interaction.edit_original_response(embed=edit_embed, view=None) old_message = await old_interaction.edit_original_response(embed=edit_embed, view=None)
await target.timeout(timedelta, reason=f"User shortmuted for {readable_duration} by {old_interaction.user.name} ({old_interaction.user.id}) for: {reason}") await target.timeout(timedelta, reason=f"User shortmuted for {readable_duration} by {old_interaction.user.name} ({old_interaction.user.id}) for: {reason}")