Interactions-py Button and SelectMenu

94 Views Asked by At

Greetings and thanks to anyone who can help in advance.

I'm making a discord bot with interactions-py I want to make the following, a menu of options that change according to a chosen button.

I have this code at the moment

slash_command(name="imbue_button", description="My first command :)")
async def imbue_botton(ctx: SlashContext):
    components: list[ActionRow] = spread_to_rows(
        Button(
        custom_id="common_id",
        style=ButtonStyle.BLUE,
        label="Common",
    ),
        Button(
        custom_id="defence_id",
        style=ButtonStyle.GREEN,
        label="Defence",
    ),
        Button(
        custom_id="skill_id",
        style=ButtonStyle.GREY,
        label="Skill",
    ),
        Button(
        custom_id="atack_id",
        style=ButtonStyle.RED,
        label="Atack",
    ),
        StringSelectMenu(
    "Pizza", "Pasta", "Burger", "Salad",
    placeholder="Choose your imbue",
    custom_id="type_imbue",
    min_values=1,
    max_values=1,
)
    )    
    embed = Embed(title="Imbue Name",
                url="https://tibia.fandom.com/wiki/",
                description="DATA DATA DATA DATA DATA DATA",
                color="#ffffff")
    embed.set_thumbnail(url="https://static.wikia.nocookie.net/tibia/images/c/cf/Basic_Venom.png/revision/latest?cb=20171026202704&path-prefix=en&format=original")
    embed.set_footer(text="probando todas las opciones")
    
    await ctx.send(embed=embed, components=components)

@listen()
async def on_component(event: Component):
    ctx = event.ctx

    match ctx.custom_id:
        case "common_id":
            await ctx.send("You clicked it!")
        case "defence_id":
            await ctx.send("You clicked defence!")
        case "atack_id":
            await ctx.send("You clicked atack")
        case "skill_id":
            await ctx.send("You clicked skill!")

I want that the list change when choose a button

0

There are 0 best solutions below