discohook icon indicating copy to clipboard operation
discohook copied to clipboard

Set `.__responded` before the request

Open imptype opened this issue 7 months ago • 0 comments

If your request results in a discord HTTP exception, for example you do

await interaction.response.send(embed = embed)

where the total characters in the embed is above 6000, that results in an HTTP Exception, which means the line self.inter._responded = True is never reached, so that attribute is never set. So this code in our error handler:

    if interaction.responded:
      await interaction.response.followup(helpers.locale_text(interaction, 'on_error_after'))
    else:
      await interaction.response.send(helpers.locale_text(interaction, 'on_error'))

won't work because .responded is False even though we already replied to the interaction and that resulted in an HTTP exception.

imptype avatar Jul 08 '24 19:07 imptype