Class: OnyxCord::Components::Container
- Inherits:
-
Object
- Object
- OnyxCord::Components::Container
- Defined in:
- lib/onyxcord/models/component.rb
Overview
A collection of components in an embed-like format.
Instance Attribute Summary collapse
-
#color ⇒ ColourRGB?
(also: #colour)
readonly
The accent colour of the container.
-
#components ⇒ Array<Component>
readonly
The child components of the container.
-
#id ⇒ Integer
readonly
The numeric identifier of the container.
-
#spoiler ⇒ true, false
(also: #spoiler?)
readonly
Whether or not the container should be blurred out.
Instance Method Summary collapse
-
#buttons ⇒ Array<Button>
Get the buttons contained within the container.
Instance Attribute Details
#color ⇒ ColourRGB? (readonly) Also known as: colour
Returns the accent colour of the container.
388 389 390 |
# File 'lib/onyxcord/models/component.rb', line 388 def color @color end |
#components ⇒ Array<Component> (readonly)
Returns the child components of the container.
397 398 399 |
# File 'lib/onyxcord/models/component.rb', line 397 def components @components end |
#id ⇒ Integer (readonly)
Returns the numeric identifier of the container.
385 386 387 |
# File 'lib/onyxcord/models/component.rb', line 385 def id @id end |
#spoiler ⇒ true, false (readonly) Also known as: spoiler?
Returns whether or not the container should be blurred out.
393 394 395 |
# File 'lib/onyxcord/models/component.rb', line 393 def spoiler @spoiler end |
Instance Method Details
#buttons ⇒ Array<Button>
Get the buttons contained within the container.
410 411 412 413 414 415 416 417 418 419 |
# File 'lib/onyxcord/models/component.rb', line 410 def @components.flat_map do |component| case component when ActionRow component. when Section component.accessory if component.accessory.is_a?(Button) end end.compact end |