Class: Discordrb::Webhooks::Modal::RowBuilder
- Inherits:
-
Object
- Object
- Discordrb::Webhooks::Modal::RowBuilder
- Defined in:
- lib/discordrb/webhooks/modal.rb
Overview
This builder is used when constructing an ActionRow. All current components must be within an action row, but this can change in the future. A message can have 5 action rows, each action row can hold a weight of 5. Buttons have a weight of 1, and dropdowns have a weight of 5.
Constant Summary collapse
- TEXT_INPUT_STYLES =
A mapping of short names to types of input styles. ‘short` is a single line where `paragraph` is a block.
{ short: 1, paragraph: 2 }.freeze
Instance Method Summary collapse
-
#text_input(style:, custom_id:, label: nil, min_length: nil, max_length: nil, required: nil, value: nil, placeholder: nil) ⇒ Object
Add a text input to this action row.
Instance Method Details
#text_input(style:, custom_id:, label: nil, min_length: nil, max_length: nil, required: nil, value: nil, placeholder: nil) ⇒ Object
Add a text input to this action row.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/discordrb/webhooks/modal.rb', line 36 def text_input(style:, custom_id:, label: nil, min_length: nil, max_length: nil, required: nil, value: nil, placeholder: nil) style = TEXT_INPUT_STYLES[style] || style @components << { style: style, custom_id: custom_id, type: COMPONENT_TYPES[:text_input], label: label, min_length: min_length, max_length: max_length, required: required, value: value, placeholder: placeholder } end |