Class: OnyxCord::Webhooks::Modal
- Inherits:
-
Object
- Object
- OnyxCord::Webhooks::Modal
- Defined in:
- lib/onyxcord/webhooks/modal.rb,
lib/onyxcord/webhooks/modal/group_builder.rb,
lib/onyxcord/webhooks/modal/label_builder.rb
Overview
Modal component builder.
Defined Under Namespace
Classes: GroupBuilder, LabelBuilder
Constant Summary collapse
- COMPONENT_TYPES =
A mapping of names to types of components usable in a modal.
{ action_row: 1, string_select: 3, text_input: 4, user_select: 5, role_select: 6, mentionable_select: 7, channel_select: 8, text_display: 10, label: 18, file_upload: 19, radio_group: 21, checkbox_group: 22, checkbox: 23 }.freeze
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Modal
constructor
A new instance of Modal.
-
#label ⇒ Object
Add a label component to the view.
-
#text_display ⇒ Object
Add a text display component to the view.
Constructor Details
#initialize {|_self| ... } ⇒ Modal
Returns a new instance of Modal.
25 26 27 28 29 |
# File 'lib/onyxcord/webhooks/modal.rb', line 25 def initialize @components = [] yield self if block_given? end |
Instance Method Details
#label ⇒ Object
Add a label component to the view.
38 39 40 |
# File 'lib/onyxcord/webhooks/modal.rb', line 38 def label(...) @components << LabelBuilder.new(...) end |
#text_display ⇒ Object
Add a text display component to the view.
44 45 46 |
# File 'lib/onyxcord/webhooks/modal.rb', line 44 def text_display(...) @components << OnyxCord::Webhooks::View::TextDisplayBuilder.new(...) end |