Nostrum.Struct.Component.Button (nostrum v0.11.0-dev)

View Source

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

interaction_button()

(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()
}

opt()

(since 0.5.0)

opts()

(since 0.5.0)
@type opts() :: [opt()]

t()

(since 0.5.0)
@type t() :: link_button() | interaction_button()

Functions

button(opts \\ [])

(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.

disable(button, disabled)

(since 0.5.0)

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

flatten(map)

(since 0.5.0)

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

(since 0.5.0)

Create an interaction button.

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

put_style(button, style)

(since 0.5.0)

Changes the style of the button.

toggle(button)

(since 0.5.0)

Toggle the buttons disabled state.