Builders for message components: buttons and select menus. They return the maps Discord expects.
Lingo.Api.Message.create(channel_id, %{
content: "Pick one",
components: [
Lingo.Component.action_row([
Lingo.Component.button(custom_id: "vote:yes", label: "Yes", style: :success),
Lingo.Component.button(custom_id: "vote:no", label: "No", style: :danger)
])
]
})Clicks reach Lingo.Bot.handle_component/2. Layout components are in
Lingo.Component.Layout and modal inputs in Lingo.Component.Modal.
Summary
Functions
A row of up to 5 buttons, or 1 select menu.
A button. Options: :style (:primary, :secondary, :success,
:danger, :link or :premium), :custom_id (or :url for links),
:label, :emoji, :disabled and :sku_id (for premium buttons).
A select menu of channels. Takes the options of user_select/2, plus :channel_types.
A preselected entry for a user, role, mentionable or channel select: type is :user, :role or :channel.
A select menu of users and roles. Takes the same options as user_select/2.
A select menu of roles. Takes the same options as user_select/2.
One choice in a string_select/2. Options: :description, :emoji and :default.
A select menu of your own choices, built with select_option/3. Options:
:options, :placeholder, :min_values, :max_values, :required and
:disabled.
A select menu of users. Options: :placeholder, :min_values,
:max_values, :default_values (see default_value/2), :required and
:disabled.
The message flag that enables components v2 (Lingo.Component.Layout). Put it in :flags.
Functions
A row of up to 5 buttons, or 1 select menu.
A button. Options: :style (:primary, :secondary, :success,
:danger, :link or :premium), :custom_id (or :url for links),
:label, :emoji, :disabled and :sku_id (for premium buttons).
A select menu of channels. Takes the options of user_select/2, plus :channel_types.
A preselected entry for a user, role, mentionable or channel select: type is :user, :role or :channel.
A select menu of users and roles. Takes the same options as user_select/2.
A select menu of roles. Takes the same options as user_select/2.
One choice in a string_select/2. Options: :description, :emoji and :default.
A select menu of your own choices, built with select_option/3. Options:
:options, :placeholder, :min_values, :max_values, :required and
:disabled.
A select menu of users. Options: :placeholder, :min_values,
:max_values, :default_values (see default_value/2), :required and
:disabled.
@spec v2_flag() :: integer()
The message flag that enables components v2 (Lingo.Component.Layout). Put it in :flags.