библиотека pycord:
MODAL DOCS
MODAL VIDEO
import discord
from discord.ext import commands
bot = commands.Bot(intents = discord.Intents.all)
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])
@bot.slash_command()
async def modal_slash(ctx):
modal = MyModal(
title = "Modal"
)
await ctx.send_modal(modal)
bot.run(TOKEN)
Написал в блокноте, так что ошибок не знаю. Можете посмотреть в документации или в видео. :)
MODAL DOCS
MODAL VIDEO