Using Modal() with Hybrid Commands #8122
Answered
by
iagolirapasssos
iagolirapasssos
asked this question in
General
Replies: 1 comment 6 replies
-
class myModal(discord.ui.Modal):
def __init__(self, title:str=None, label:str=None, placeholder:str=None, min_length:int=1, max_length:int=300, form_style=discord.TextStyle.long, custom_id:str=None, required:bool=True) -> None:
super().__init__(title=title, custom_id=custom_id)
self.add_item(
discord.ui.TextInput(
label = label,
style = form_style,
placeholder = placeholder,
required = required,
max_length = max_length,
)
)
async def on_submit(self, interaction: discord.Interaction):
await interaction.response.send_message(f"Submitting form! Wait!... {self.children[0].value}")
async def on_error(self, interaction: discord.Interaction, error: Exception) -> None:
await interaction.response.send_message('Oops! Something went wrong.', ephemeral=True)
# Make sure we know what the error actually is
traceback.print_tb(error.__traceback__) |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
iagolirapasssos
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Modal
Button:
GeneralButton
Error:
Help me, please! So far I haven't been able to use Modal() with hybrid commands. If anyone has an example, please share.
Note: the buttons work normally, without any problem. But when I press the button the above error appears.
Beta Was this translation helpful? Give feedback.
All reactions