Class: Discordrb::Webhooks::View
- Inherits:
-
Object
- Object
- Discordrb::Webhooks::View
- Defined in:
- lib/discordrb/webhooks/view.rb
Overview
A reusable view representing a component collection, with builder methods.
Direct Known Subclasses
Defined Under Namespace
Classes: ContainerBuilder, FileBuilder, MediaGalleryBuilder, RowBuilder, SectionBuilder, SelectMenuBuilder, SeparatorBuilder, TextDisplayBuilder
Constant Summary collapse
- BUTTON_STYLES =
Possible button style names and values.
{ primary: 1, secondary: 2, success: 3, danger: 4, link: 5 }.freeze
- SEPARATOR_SIZES =
Possible separator size names and values.
{ small: 1, large: 2 }.freeze
- COMPONENT_TYPES =
Component types.
{ action_row: 1, button: 2, string_select: 3, # text_input: 4, # (defined in modal.rb) user_select: 5, role_select: 6, mentionable_select: 7, channel_select: 8, section: 9, text_display: 10, thumbnail: 11, media_gallery: 12, file: 13, separator: 14, container: 17 # label: 18, # (defined in modal.rb) # file_upload: 19, (defined in modal.rb) # radio_group: 21, (defined in modal.rb) # checkbox_group: 22, (defined in modal.rb) # checkbox: 23 (defined in modal.rb) }.freeze
Instance Method Summary collapse
-
#container ⇒ Object
Add a container component to the view.
-
#file ⇒ Object
(also: #file_display)
Add a file component to the view.
-
#media_gallery ⇒ Object
Add a media gallery component to the view.
-
#row ⇒ Object
Add a row component to the view.
-
#section ⇒ Object
Add a section component to the view.
-
#separator ⇒ Object
Add a separator component to the view.
-
#text_display ⇒ Object
Add a text display component to the view.
Instance Method Details
#container ⇒ Object
Add a container component to the view.
459 460 461 |
# File 'lib/discordrb/webhooks/view.rb', line 459 def container(...) @components << ContainerBuilder.new(...) end |
#file ⇒ Object Also known as: file_display
Add a file component to the view.
439 440 441 |
# File 'lib/discordrb/webhooks/view.rb', line 439 def file(...) @components << FileBuilder.new(...) end |
#media_gallery ⇒ Object
Add a media gallery component to the view.
471 472 473 |
# File 'lib/discordrb/webhooks/view.rb', line 471 def media_gallery(...) @components << MediaGalleryBuilder.new(...) end |
#row ⇒ Object
Add a row component to the view.
433 434 435 |
# File 'lib/discordrb/webhooks/view.rb', line 433 def row(...) @components << RowBuilder.new(...) end |
#section ⇒ Object
Add a section component to the view.
447 448 449 |
# File 'lib/discordrb/webhooks/view.rb', line 447 def section(...) @components << SectionBuilder.new(...) end |
#separator ⇒ Object
Add a separator component to the view.
453 454 455 |
# File 'lib/discordrb/webhooks/view.rb', line 453 def separator(...) @components << SeparatorBuilder.new(...) end |
#text_display ⇒ Object
Add a text display component to the view.
465 466 467 |
# File 'lib/discordrb/webhooks/view.rb', line 465 def text_display(...) @components << TextDisplayBuilder.new(...) end |