The code:
@bot.command()
async def team_setup(message):
view = View()
setup_btn = Button(label="Setup", style=discord.ButtonStyle.green, emoji="๐ ๏ธ")
view.add_item(setup_btn)
setup_modal = Modal(title="Team Setup")
setup_modal.add_item(TextInput(label="Team Name", placeholder="Example: Luigi Destroyers FC", max_length=20))
async def button_callback(interaction):
await interaction.response.send_modal(setup_modal)
async def on_submit(interaction: discord.Interaction):
await message.channel.send(setup_modal.children[0].value)
setup_modal.on_submit = on_submit
setup_btn.callback = button_callback
await message.channel.send("Setup your team to get started", view=view)
So you run the team_setup command, and then it responds with a button, you click it, and then a modal pops up. Once you submit the modal, it says "Something went wrong, try again."
await message.channel.send(setup_modal.children[0].value)
It does post what I entered in the modal after submitting. However, it doesn't exit the modal and instead shows the error.