@@ -64,14 +64,26 @@ fun Modals.create(title: String, block: ModalBuilder.() -> Unit): Modal {
6464 return create(title).apply (block).build()
6565}
6666
67- fun ModalBuilder.textInput (inputName : String , label : String , inputStyle : TextInputStyle , block : TextInputBuilder .() -> Unit = {}): TextInput =
68- modals.createTextInput(inputName, label, inputStyle)
67+ fun ModalBuilder.textInput (inputName : String , label : String , inputStyle : TextInputStyle , block : TextInputBuilder .() -> Unit = {}): TextInput {
68+ contract {
69+ callsInPlace(block, InvocationKind .EXACTLY_ONCE )
70+ }
71+ return modals.createTextInput(inputName, label, inputStyle)
6972 .apply (block)
7073 .build()
7174 .also { addActionRow(it) }
75+ }
7276
73- fun ModalBuilder.shortTextInput (inputName : String , label : String , block : TextInputBuilder .() -> Unit = {}): TextInput =
74- textInput(inputName, label, TextInputStyle .SHORT , block)
77+ fun ModalBuilder.shortTextInput (inputName : String , label : String , block : TextInputBuilder .() -> Unit = {}): TextInput {
78+ contract {
79+ callsInPlace(block, InvocationKind .EXACTLY_ONCE )
80+ }
81+ return textInput(inputName, label, TextInputStyle .SHORT , block)
82+ }
7583
76- fun ModalBuilder.paragraphTextInput (inputName : String , label : String , block : TextInputBuilder .() -> Unit = {}): TextInput =
77- textInput(inputName, label, TextInputStyle .PARAGRAPH , block)
84+ fun ModalBuilder.paragraphTextInput (inputName : String , label : String , block : TextInputBuilder .() -> Unit = {}): TextInput {
85+ contract {
86+ callsInPlace(block, InvocationKind .EXACTLY_ONCE )
87+ }
88+ return textInput(inputName, label, TextInputStyle .PARAGRAPH , block)
89+ }
0 commit comments