S
S
Shii Tatakamui2021-12-10 11:08:44
Python
Shii Tatakamui, 2021-12-10 11:08:44

I can't figure out how to write buttons for Discord bots, Discord_Components... Gives(interaction error) how to fix?

async def knopka(ctx):
    await ctx.send(
        embed = discord.Embed(title = '**Открыть клад?**', timestamp = ctx.message.created_at),
        components = [
            Button(style = ButtonStyle.green, label = 'Да'),
            Button(style = ButtonStyle.red, label = 'Нет')
        ])
    responce = await client.wait_for('button_click', check = lambda message: message.author == ctx.author)
    if responce.channel == ctx.channel:
        if responce.component.label == 'Да':
            await responce.respond(content = 'Недоступно')
        else:
            await responce.respond(content = 'Ты нажал на Нет?')
@client.command()

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question