discord_gleam/types/interaction

Types

pub type InteractionCallbackData {
  MessageCallbackData(
    tts: option.Option(Bool),
    content: option.Option(String),
    embeds: option.Option(List(embed.Embed)),
    allowed_mentions: option.Option(List(String)),
    flags: option.Option(Int),
  )
  ModalCallbackData(
    custom_id: String,
    title: String,
    components: List(component.Component),
  )
}

Constructors

pub type InteractionCallbackType {
  Pong
  ChannelMessageWithSource
  DeferredChannelMessageWithSource
  DeferredUpdateMessage
  UpdateMessage
  ApplicationCommandAutocompleteResult
  Modal
}

Constructors

  • Pong
  • ChannelMessageWithSource
  • DeferredChannelMessageWithSource
  • DeferredUpdateMessage
  • UpdateMessage
  • ApplicationCommandAutocompleteResult
  • Modal
pub type InteractionResponse {
  InteractionResponse(
    type_: InteractionCallbackType,
    data: InteractionCallbackData,
  )
}

Constructors

Values

pub fn callback_type_to_int(
  type_: InteractionCallbackType,
) -> Int
pub fn custom_response(
  interaction: interaction_create.InteractionCreatePacketData,
  response: InteractionResponse,
) -> Result(Nil, @internal DiscordError)

Send a custom response to a slash command interaction.
You need to construct a response using InteractionResponse yourself.

pub fn defer_response(
  interaction: interaction_create.InteractionCreatePacketData,
  ephemeral ephemeral: Bool,
) -> Result(Nil, @internal DiscordError)

Used to defer a response to a interaction, will show as the bot is thinking to the user.

pub fn edit_response(
  interaction: interaction_create.InteractionCreatePacketData,
  message message: message.Message,
) -> Result(Nil, @internal DiscordError)

Used to edit the original response to a interaction, for example after deferring the response.

pub fn send_message(
  interaction: interaction_create.InteractionCreatePacketData,
  message message: message.Message,
  ephemeral ephemeral: Bool,
) -> Result(Nil, @internal DiscordError)

Send a message as a response to a slash command interaction.
If ephemral is true, the response will only be shown to the executor.

pub fn to_string(response: InteractionResponse) -> String
Search Document