Search code examples
discordnextcord

Can't respond to Interaction after using interaction.response.defer() [Nextcord]


I have a slash command, but it requires few seconds for processing. Since Discord limitation for responding to interactions seems to be 3s, i found on the documentation the interaction.response.defer() method, that should tell Discord that i've recieved the command (not to throw the error "Interaction didn't responded.")

@client.slash_command(description="Test command", guild_ids=[123456789123456789])
async def test(interaction: nextcord.Interaction):
    await interaction.response.defer()
    await asyncio.sleep(10) # Doing stuff
    await interaction.response.send_message("My actual content")

But I get this error :

nextcord.errors.InteractionResponded: This interaction has already been responded to before

What am I doing wrong ?


Solution

  • interaction.followup.send() should be used instead of send_message()