Skip to content
Advertisement

Error: discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction discord.py when sending a gif in embed

I’m making a discord bot that sends a message with two buttons. Both buttons sends a message with a picture/gif when pressed. One of them works but the other one gives an error:

JavaScript

Here is the full code:

JavaScript

Why does this happen?

Advertisement

Answer

With discord API you need to send an initial response within 3 seconds and afterward, you have 15 minutes to send the follow-up message. You should look into deferring. You’re uploading an image that might take some time and you might need to defer the message.
Instead of doing :

Interaction.response.send_message()

Try :

Interaction.response.defer()
asyncio.sleep()
Interaction.followup.send()

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement