Помогите написать код для бота в дискорд!
Мне надо чтобы по команде создавалось модальное окно и в нем были поля для ввода и меню выбора. у меня уже есть код но он не работает и выдаёт разные ошибки. пишу на disnake вот код:
class MyView(disnake.ui.View):
def __init__(self):
super().__init__(timeout=None)
@disnake.ui.button(label="Отправить", style=disnake.ButtonStyle.primary, custom_id='button1')
async def first_button_callback(self, button: disnake.ui.Button, inter: disnake.AppCmdInter):
await inter.response.send_modal(RecruitementModal())
class RecruitementModal(disnake.ui.Modal, disnake.ui.Select):
def __init__(self):
components = [
disnake.ui.TextInput(label="Ваше имя(ник)", placeholder="Введите ваше имя(ник)", custom_id="name"),
disnake.ui.TextInput(label="Ваш возраст", placeholder="Введите ваш возраст", custom_id="age"),
disnake.ui.TextInput(label="Ваш ник в дискорде(для заявки в друзья)", placeholder="Введите ваш ник в дискорде", custom_id="nick_ds"),
disnake.ui.TextInput(label="О вас", placeholder="О вас", custom_id="about"),
disnake.SelectOption(label="Dota 2", value='Dota 2'),
disnake.SelectOption(label="Valorant", value='Valorant'),
disnake.SelectOption(label="Genshin Impact", value='Genshin Impact'),
disnake.SelectOption(label="Minecraft", value='Minecraft'),
disnake.SelectOption(label="Fortnite", value='Fortnite'),
disnake.SelectOption(label="Общение", value='Сommunication')
]
super().__init__(title='title', components=components, custom_id="recruitementModal")
async def callback(self, interaction: disnake.ModalInteraction and disnake.MessageInteraction) -> None:
name = interaction.text_values["name"]
age = interaction.text_values["age"]
nick_ds = interaction.text_values["nick_ds"]
about = interaction.text_values["about"]
selectings = {int(value) for value in interaction.values}
embed = disnake.Embed(color=2, title="Хорош")
embed.description = f"{name}, {age}, {nick_ds}, {about}, {selectings} "
embed.set_thumbnail(url=interaction.author.display_avatar.url)
await interaction.response.send_message(embed=embed, ephemeral=True)
@bot.slash_command(name='start', description='start')
async def start(interaction):
view = MyView()
await interaction.response.send_message(embed=disnake.Embed(color=2,
title="Добро пожаловать!",
description="бла бла бла"
), view=view, ephemeral=True)
Ошибка:
TypeError: components must be a WrappedComponent or ActionRow, a sequence/list of WrappedComponents or ActionRows, or a nested sequence/list of WrappedComponents