Add docstring example for ui.Modal

This commit is contained in:
Pawnyy 2022-03-06 18:29:38 -05:00 committed by GitHub
parent a909c1ff06
commit 6788ec2533
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,6 +58,19 @@ class Modal(View):
This object must be inherited to create a modal popup window within discord.
.. versionadded:: 2.0
Examples
----------
.. code-block:: python3
from discord import ui
class Questionnaire(ui.Modal, title='Questionnaire Response'):
name = ui.TextInput(label='Name')
answer = ui.TextInput(label='Answer', style=discord.TextStyle.paragraph)
async def on_submit(self, interaction: discord.Interaction):
await interaction.response.send_message(f'Thanks for your response, {self.name}!', ephemeral=True)
Parameters
-----------