T
T
theycallmenazar2021-11-02 17:55:13
Python
theycallmenazar, 2021-11-02 17:55:13

I want to make a button in a button (and it works) discord-components?

@bot.command()
async def test(ctx):
    components = [
            Button(label='Тест', style=ButtonStyle.blue, custom_id='blue'),
            Button(label='Тест2', style=ButtonStyle.red, custom_id='red'),
            Button(label='Тееест', style=ButtonStyle.green, custom_id='green'),
            Button(label='Тест3', style=ButtonStyle.gray, custom_id='gray'),
            Button(label='URL', style=ButtonStyle.URL, url='http://google.com')
        ]
    
    message = await ctx.send('Тест.', components=components)

    while True:
        interaction = await bot.wait_for(
                'interaction',
                check=lambda inter: inter.message.id == message.id,
                timeout=999999
            )
        if interaction.channel == ctx.channel:
         if interaction.component.label == "Тест":
            await interaction.respond(
                embed=discord.Embed(title="Нажми"),
                components=[
                    Button(style=ButtonStyle.green, label="Yes", custom_id='green'),
                    Button(style=ButtonStyle.red, label="No", custom_id='red')
                 
                ]
            
            ) 
         if interaction.component.label == "Yes":
            await interaction.respond(content="1. Да")
         if interaction.component.label == "No":

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