Class: OnyxCord::Webhooks::View::MediaGalleryBuilder
- Inherits:
-
Object
- Object
- OnyxCord::Webhooks::View::MediaGalleryBuilder
- Defined in:
- lib/onyxcord/webhooks/view.rb
Overview
A media gallery component is a gallery grid.
Instance Method Summary collapse
-
#initialize(id: nil) {|builder| ... } ⇒ MediaGalleryBuilder
constructor
Create a media gallery component.
-
#item(url:, description: nil, spoiler: false) ⇒ Object
Add a gallery item to the media gallery component.
Constructor Details
#initialize(id: nil) {|builder| ... } ⇒ MediaGalleryBuilder
Create a media gallery component.
299 300 301 302 303 304 |
# File 'lib/onyxcord/webhooks/view.rb', line 299 def initialize(id: nil) @id = id @items = [] yield self if block_given? end |
Instance Method Details
#item(url:, description: nil, spoiler: false) ⇒ Object
Add a gallery item to the media gallery component.
310 311 312 |
# File 'lib/onyxcord/webhooks/view.rb', line 310 def item(url:, description: nil, spoiler: false) @items << { media: { url: }, description: description, spoiler: spoiler }.compact end |