fix(aurora): defer the interaction so it doesn't expire

This commit is contained in:
Seaswimmer 2024-02-02 11:47:51 -05:00
parent d1afd62114
commit 4d321006c8
Signed by untrusted user: cswimr
GPG key ID: B8953EC01E5C4063

View file

@ -379,11 +379,12 @@ class Aurora(commands.Cog):
except discord.errors.HTTPException: except discord.errors.HTTPException:
pass pass
await interaction.response.defer()
await target.add_roles( await target.add_roles(
role, role,
reason=f"Role added by {interaction.user.id}{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')} for: {reason}", reason=f"Role added by {interaction.user.id}{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')} for: {reason}",
) )
await interaction.response.send_message( response: discord.WebhookMessage = await interaction.followup.send(
content=f"{target.mention} has been given the {role.mention} role{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')}!\n**Reason** - `{reason}`" content=f"{target.mention} has been given the {role.mention} role{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')}!\n**Reason** - `{reason}`"
) )
@ -397,8 +398,8 @@ class Aurora(commands.Cog):
duration, duration,
reason, reason,
) )
await interaction.edit_original_response( await response.edit(
content=f"{target.mention} has been given the {role.mention} role{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`" content=f"{target.mention} has been given the {role.mention} role{(' for ' + {humanize.precisedelta(parsed_time)} if parsed_time != 'NULL' else '')}! (Case `#{moderation_id:,}`)\n**Reason** - `{reason}`",
) )
await log(interaction, moderation_id) await log(interaction, moderation_id)