'I have discord.py bot and tried the new integrations (with discord_components), but it doesn't want to listen to the selection event

Here is my color command:

@bot.command()
async def color(ctx):
    await ctx.send(
        "hello!",
        components=[
            Select(
                placeholder="Pick a color",
                options=[
                    SelectOption(label="Red", value="red", emoji="🔴"),
                    SelectOption(label="Blue", value="blue", emoji="🔵")
                        ]
                    )
                ]
            )

How do I know what the user selects ? ​ ​ ​ I tried:

def on_select_option(interaction):

Does not work.

await bot.wait_for("select_option", check=None)

Does not work either, even in a loop. ​ ​ ​ How do I do it ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source