disnake | 'NoneType' object is not subscriptable в
Пишу бота с получением заявок Modal Dialogs, не могу связать кнопку с анкетой.
client.slash_command()
async def buttons(interaction: disnake.ApplicationCommandInteraction):
embed = disnake.Embed(title="**Подать заявку**", description=f"Заявка рассматривается в течении 24 часов!\n Не нужно писать Администрации что-бы проверили вашу заявку!\n\n", color=0x0000FF)
await interaction.response.send_message(embed=embed,
components=[
disnake.ui.Button(label="Подать заявку", style=disnake.ButtonStyle.success, custom_id="yes")
],)
class RecruitementModal(disnake.ui.Modal):
def __init__(self, arg):
self.arg = arg
components = [
disnake.ui.TextInput(label="Ваша имя", placeholder="Введите ваша имя", custom_id="name"),
disnake.ui.TextInput(label="Ваша возрост", placeholder="Введите ваша возрост", custom_id="age")
]
super().__init__(title=title, components=components, custom_id='RecruitementModal')
async def callback(self, interaction: disnake.ModalInteraction) -> None:
name = interaction.text_values["name"]
age = interaction.text_values["age"]
embed = disnake.Embed(title="Заявка", description=f"Заявка успешно отправлина!", color=0x0000FF)
await interaction.response.send_message(embed=embed)
channel= interaction.guild.get_channel(993421342621839432)
embed = disnake.Embed(title="Заявка", description=f"Имя {name} {interaction.author.mention} ({age} лет)", color=0x0000FF)
await interaction.response.send_message(embed=embed)
@client.listen("on_button_click")
async def help_listener(interaction: disnake.MessageInteraction):
if interaction.component.custom_id not in ["yes"]:
return
if interaction.component.custom_id == "yes":
await interaction.response.send_modal(RecruitementModal(interaction.values[0]))