#Message in variable deleted after delay

1 messages · Page 1 of 1 (latest)

alpine saffron
#
embed = disnake.Embed(
            title="Chat Cleared!",
            description=f"**{interaction.author}** cleared **{amount}** messages!",
            color=0xff0000
        )
        tempMsg = await interaction.send(embed=embed)
        await asyncio.sleep(5)
        await tempMsg.delete()
#

This gives the following error:

#

disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'delete'

royal ginkgo
#

inter.response.send_message() (interaction.send) doesn't return anything

#

-d disnake.ApplicationCommandInteraction

forest houndBOT
#

class disnake.ApplicationCommandInteraction```
Represents an interaction with an application command.

Current examples are slash commands, user commands and message commands.

New in version 2.1.
royal ginkgo
#

msg = await interaction.original_response() is what you need

#

But you can also just do..

await interaction.response.send_message(embed=embed, delete_after=5)
#

or even

await interaction.response.send_message(embed=embed, ephemeral=True)

then it doesn't even appear in chat and only the command user can see it