код:
class MyModal(discord.ui.Modal):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.add_item(discord.ui.InputText(label="Short Input"))
self.add_item(discord.ui.InputText(label="Long Input", style=discord.InputTextStyle.long))
async def callback(self, interaction: discord.Interaction):
embed = discord.Embed(title="Modal Results")
embed.add_field(name="Short Input", value=self.children[0].value)
embed.add_field(name="Long Input", value=self.children[1].value)
await interaction.response.send_message(embeds=[embed])
class MyView(discord.ui.View):
@discord.ui.button(label="Send Modal")
async def button_callback(self, button, interaction):
await interaction.response.send_modal(MyModal(title="Modal via Button"))
@client.command(aliases = ['lered', 'selfe'])
async def __modal(ctx):
await ctx.send(view=MyView())