TimeDeod
TimeDeod

Reputation: 29

Discord.py button interaction message delete

    interaction = await bot.wait_for("button_click", check=lambda i: i.component.label.startswith("Delete"))
    await interaction.delete()

When I press it it says interation failed.

Upvotes: 0

Views: 5826

Answers (1)

TheUltimateGuide
TheUltimateGuide

Reputation: 353

The reason why this is happening is because await interaction.delete() doesn't delete anything. According to the docs for Client.wait_for, it returns

Returns no arguments, a single argument, or a tuple of multiple arguments that mirrors the parameters passed in the event reference."

If you want to delete the original message, get where you sent the message as msg = await ctx.send("stuff here") and delete with await msg.delete() Your bot has to have Manage Messages even to delete their own messages though.

Upvotes: 1

Related Questions