Module: DiscordRDA::Components

Defined in:
lib/discord_rda/interactions/components.rb

Overview

Component V2 - Discord’s updated message components system. Supports Action Rows, Buttons, Select Menus, and Text Inputs.

Defined Under Namespace

Classes: ActionRow, Base, Builder, Button, ChannelSelect, Container, FileComponent, MediaGallery, MentionableSelect, RoleSelect, Section, SelectMenu, Separator, StringSelect, TextDisplay, TextInput, Thumbnail, UserSelect

Constant Summary collapse

TYPES =

Component types

{
  action_row: 1,
  button: 2,
  string_select: 3,
  text_input: 4,
  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
}.freeze
BUTTON_STYLES =

Button styles

{
  primary: 1,     # Blurple
  secondary: 2,   # Grey
  success: 3,     # Green
  danger: 4,      # Red
  link: 5,        # URL button
  premium: 6      # SKU button
}.freeze
TEXT_INPUT_STYLES =

Text input styles

{
  short: 1,       # Single line
  paragraph: 2    # Multi-line
}.freeze

Class Method Summary collapse

Class Method Details

.build {|Builder| ... } ⇒ Array<Hash>

Convenience method to create components

Yields:

Returns:

  • (Array<Hash>)

    Components array



458
459
460
461
462
# File 'lib/discord_rda/interactions/components.rb', line 458

def self.build(&block)
  builder = Builder.new
  block.call(builder) if block
  builder.to_a
end