1111)
1212
1313
14- class MyModal (discord .ui .Modal ):
14+ class MyModal (discord .ui .DesignerModal ):
1515 def __init__ (self , * args , ** kwargs ) -> None :
16- super (). __init__ (
16+ first_input = discord . ui . Label (
1717 discord .ui .InputText (
18- label = "Short Input" ,
1918 placeholder = "Placeholder Test" ,
2019 ),
20+ label = "Short Input"
21+ )
22+ second_input = discord .ui .Label (
2123 discord .ui .InputText (
22- label = "Longer Input " ,
24+ placeholder = "Placeholder Test " ,
2325 value = "Longer Value\n Super Long Value" ,
2426 style = discord .InputTextStyle .long ,
25- description = "You can also describe the purpose of this input." ,
2627 ),
27- discord .ui .TextDisplay ("# Personal Questions" ),
28+ label = "Longer Input" ,
29+ description = "You can also describe the purpose of this input." ,
30+ )
31+ select = discord .ui .Label (
2832 discord .ui .Select (
29- label = "What's your favorite color?" ,
3033 placeholder = "Select a color" ,
3134 options = [
3235 discord .SelectOption (label = "Red" , emoji = "🟥" ),
3336 discord .SelectOption (label = "Green" , emoji = "🟩" ),
3437 discord .SelectOption (label = "Blue" , emoji = "🟦" ),
3538 ],
36- description = "If it is not listed, skip this question." ,
3739 required = False ,
3840 ),
41+ label = "What's your favorite color?" ,
42+ description = "If it is not listed, skip this question." ,
43+ )
44+ super ().__init__ (
45+ first_input ,
46+ second_input ,
47+ discord .ui .TextDisplay ("# Personal Questions" ), # TextDisplay does NOT use Label
48+ select ,
3949 * args ,
4050 ** kwargs ,
4151 )
@@ -45,10 +55,10 @@ async def callback(self, interaction: discord.Interaction):
4555 title = "Your Modal Results" ,
4656 fields = [
4757 discord .EmbedField (
48- name = "First Input" , value = self .children [0 ].value , inline = False
58+ name = "First Input" , value = self .children [0 ].item . value , inline = False
4959 ),
5060 discord .EmbedField (
51- name = "Second Input" , value = self .children [1 ].value , inline = False
61+ name = "Second Input" , value = self .children [1 ].item . value , inline = False
5262 ),
5363 ],
5464 color = discord .Color .random (),
0 commit comments