U
U
UniFild4452022-04-05 18:07:46
Python
UniFild445, 2022-04-05 18:07:46

How to make select menu?

I am writing my discord bot in python. I recently learned about select menu, started to try and ran into the following problem: The menu becomes unclickable after the first click. Those. I write a command, select 1 of 2 options and everything works, but the second time I write "interaction error", what should I do about it?

The code:

from discord_components import DiscordComponents, ComponentsBot, Button
from dislash import SlashClient, ActionRow, Button
from dislash import SlashClient, SelectMenu, SelectOption
from discord_components import DiscordComponents, ComponentsBot, Button, Select, SelectOption


DiscordComponents(bot)

@bot.command()
async def select(ctx):

    msg = await ctx.send(
        components = [
            Select(
                placeholder = "Выбирете категорию!",
                options = [
                    SelectOption(label = "Модерация", value = 'описание'), #Сделаем краткое описание за место "описание"
                    SelectOption(label = "Резвлечения", value = "Описание")
                ]
            )
        ]
    )
    emb = discord.Embed(title = f'Модерация', description = 'Описание', color = 0xff00)
    interaction = await bot.wait_for("select_option")
    await interaction.send(embed = emb, content = f"{interaction.values[0]}")

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