I created a button on my discord bot using various tutorials, but it still doesn't work. I've tried everything, but it still gives the error Interaction failed
my code:
import discord
from discord.ext import commands
from discord.ui import Button, View
bot = commands.Bot(command_prefix='k.', intents=discord.Intents.all())
@bot.command()
async def meow(ctx):
await ctx.send('click `meow` button pls', view=View(
Button(custom_id='click',
label='meow!',
style=discord.ButtonStyle.blurple)))
interaction = await bot.wait_for('interaction',
check=lambda i: i.custom_id == 'click')
await interaction.response.edit_message(content='meow!', view=None)
Try to create a class for your button. Call it in the class and respond to the interaction directly.
Example code: