Class: DiscordRDA::Components::TextInput
- Defined in:
- lib/discord_rda/interactions/components.rb
Overview
Text Input (for modals)
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.paragraph(**kwargs) ⇒ Object
Create a paragraph text input.
-
.short(**kwargs) ⇒ Object
Create a short text input.
Instance Method Summary collapse
-
#initialize(style:, custom_id:, label:, placeholder: nil, min_length: nil, max_length: nil, required: true, value: nil) ⇒ TextInput
constructor
A new instance of TextInput.
Methods inherited from Base
Constructor Details
#initialize(style:, custom_id:, label:, placeholder: nil, min_length: nil, max_length: nil, required: true, value: nil) ⇒ TextInput
Returns a new instance of TextInput.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/discord_rda/interactions/components.rb', line 270 def initialize(style:, custom_id:, label:, placeholder: nil, min_length: nil, max_length: nil, required: true, value: nil) style_val = TEXT_INPUT_STYLES[style] || style data = { style: style_val, custom_id: custom_id, label: label, required: required } data[:placeholder] = placeholder if placeholder data[:min_length] = min_length if min_length data[:max_length] = max_length if max_length data[:value] = value if value super(:text_input, data) end |
Class Method Details
.paragraph(**kwargs) ⇒ Object
Create a paragraph text input
294 295 296 |
# File 'lib/discord_rda/interactions/components.rb', line 294 def self.paragraph(**kwargs) new(style: :paragraph, **kwargs) end |
.short(**kwargs) ⇒ Object
Create a short text input
288 289 290 |
# File 'lib/discord_rda/interactions/components.rb', line 288 def self.short(**kwargs) new(style: :short, **kwargs) end |