Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question