Is discord.ui.Modal supports button? #8312
-
I've tried, but it raises an error.
This is the minimum code. import discord
import discord.app_commands
import discord.ui
token = #TOKEN here
client = discord.Client(intents=discord.Intents.default())
tree = discord.app_commands.CommandTree(client)
@tree.command(
name="modal",
description="Send modal."
)
async def modal(ctx:discord.Interaction):
modal=discord.ui.Modal(title="Hello!")
modal.add_item(discord.ui.Button(label="Button"))
await ctx.response.send_modal(modal)
@client.event
async def on_ready():
print("ready")
await tree.sync()
client.run(token) How can I fix this? Or Is It not able? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Modals only support Select and TextInput components. |
Beta Was this translation helpful? Give feedback.
-
I forgot to close. sorry 🙏 |
Beta Was this translation helpful? Give feedback.
-
Update for future developers:
As mentioned by Discord here and here, Modal only supports Text Input, so Select and Button will not work. |
Beta Was this translation helpful? Give feedback.
Modals only support Select and TextInput components.