#Help with Modals

1 messages · Page 1 of 1 (latest)

boreal nest
#

How would I rewrite the code below so that it closes after you click submit?

@bot.slash_command(name= 'modal', description = 'An example of a modal!')
async def test(ctx):
    modal = Modal('New Page')
    modal.add_item(InputText(label = 'Title',style = pycord.InputTextStyle.short))
    modal.add_item(InputText(label = 'Description',style = pycord.InputTextStyle.long))
    async def modal_callback(interaction: pycord.Interaction):
        modal.stop()
    modal.callback = modal_callback
    await ctx.interaction.response.send_modal(modal)
    await modal.wait()
    print([i.value for i in modal.children])
```any help is appreciated!
#

Help with Modals

karmic forum
#

All modals close after you click submit