View Source Nostrum.Struct.Component.Button (Nostrum v0.10.0)

Helpers for dealing with Button Components

Summary

Functions

Create a button.

Disables the button when disabled is true. Enables it otherwise.

Create an interaction button.

Create a link button.

Changes the style of the button.

Toggle the buttons disabled state.

Types

Link to this type

interaction_button()

View Source (since 0.5.0)
@type interaction_button() :: %Nostrum.Struct.Component{
  channel_types: term(),
  components: term(),
  custom_id: Nostrum.Struct.Component.custom_id(),
  default_values: term(),
  disabled: Nostrum.Struct.Component.disabled(),
  emoji: Nostrum.Struct.Component.emoji(),
  label: Nostrum.Struct.Component.label(),
  max_length: term(),
  max_values: term(),
  min_length: term(),
  min_values: term(),
  options: term(),
  placeholder: term(),
  required: term(),
  style: Nostrum.Struct.Component.style(),
  type: Nostrum.Struct.Component.type(),
  url: term(),
  value: term()
}
@type opts() :: [opt()]
@type t() :: link_button() | interaction_button()

Functions

Link to this function

button(opts \\ [])

View Source (since 0.5.0)

Create a button.

This function provides direct access to the new/1 callback.

Note: While using this function directly you are not guaranteed to return a valid button, providing a valid combination of options becomes the responsibility of the reader. It is instead recommended to use the helper functions provided below.

Link to this function

disable(button, disabled)

View Source (since 0.5.0)

Disables the button when disabled is true. Enables it otherwise.

Link to this function

flatten(map)

View Source (since 0.5.0)
Link to this function

interaction_button(label, custom_id, opts \\ [])

View Source (since 0.5.0)

Create an interaction button.

Read more about interaction buttons in the Nostrum.Struct.Component documentation.

Link to this function

put_style(button, style)

View Source (since 0.5.0)

Changes the style of the button.

Link to this function

toggle(button)

View Source (since 0.5.0)

Toggle the buttons disabled state.