grom/interaction

Types

pub type ButtonExecution {
  ButtonExecution(
    custom_id: String,
    resolved: option.Option(Resolved),
  )
}

Constructors

pub type ChannelSelectExecution {
  ChannelSelectExecution(
    custom_id: String,
    selected_channels_ids: List(String),
    resolved: option.Option(Resolved),
  )
}

Constructors

  • ChannelSelectExecution(
      custom_id: String,
      selected_channels_ids: List(String),
      resolved: option.Option(Resolved),
    )
pub type CommandExecution {
  SlashCommandExecuted(SlashCommandExecution)
  MessageCommandExecuted(MessageCommandExecution)
  UserCommandExecuted(UserCommandExecution)
}

Constructors

pub type Context {
  TriggeredInGuild
  TriggeredInBotDms
  TriggeredInPrivateChannel
}

Constructors

  • TriggeredInGuild
  • TriggeredInBotDms
  • TriggeredInPrivateChannel
pub type Data {
  CommandExecuted(CommandExecution)
  MessageComponentExecuted(MessageComponentExecution)
  ModalSubmitted(ModalSubmission)
}

Constructors

pub type FileUploadSubmission {
  FileUploadSubmission(
    id: Int,
    custom_id: String,
    uploaded_files_ids: List(String),
  )
}

Constructors

  • FileUploadSubmission(
      id: Int,
      custom_id: String,
      uploaded_files_ids: List(String),
    )
pub type Followup {
  Followup(
    content: option.Option(String),
    is_tts: Bool,
    embeds: option.Option(List(embed.Embed)),
    allowed_mentions: option.Option(
      allowed_mentions.AllowedMentions,
    ),
    components: option.Option(List(message.Component)),
    files: option.Option(List(file.File)),
    attachments: option.Option(List(attachment.Create)),
    flags: option.Option(List(FollowupFlag)),
    poll: option.Option(poll.Create),
  )
}

Constructors

pub type FollowupFlag {
  EphemeralFollowup
  FollowupWithSuppressedEmbeds
  FollowupWithSuppressedNotifications
  FollowupWithComponentsV2
}

Constructors

  • EphemeralFollowup
  • FollowupWithSuppressedEmbeds
  • FollowupWithSuppressedNotifications
  • FollowupWithComponentsV2
pub type Interaction {
  Interaction(
    id: String,
    application_id: String,
    data: Data,
    invokement_info: InvokementInfo,
    channel_id: String,
    token: String,
    message: option.Option(message.Message),
    application_permissions: List(permission.Permission),
    locale: String,
    entitlements: option.Option(List(entitlement.Entitlement)),
    authorizing_integration_owners_ids: dict.Dict(
      application.InstallationContext,
      String,
    ),
    context: option.Option(Context),
    attachment_size_limit_bytes: Int,
  )
}

Constructors

pub type InvokementInfo {
  InvokedInGuild(
    guild_id: String,
    member: guild_member.GuildMember,
    guild_locale: String,
  )
  InvokedInDm(user: user.User)
}

Constructors

pub type LabelSubmission {
  LabelSubmission(id: Int, component: SubmittedLabelComponent)
}

Constructors

pub type MentionableSelectExecution {
  MentionableSelectExecution(
    custom_id: String,
    selected_mentionables_ids: List(String),
    resolved: option.Option(Resolved),
  )
}

Constructors

  • MentionableSelectExecution(
      custom_id: String,
      selected_mentionables_ids: List(String),
      resolved: option.Option(Resolved),
    )
pub type MessageCommandExecution {
  MessageCommandExecution(
    id: String,
    name: String,
    resolved: option.Option(Resolved),
    registered_to_guild_id: option.Option(String),
    message_id: String,
  )
}

Constructors

pub type MessageComponentExecution {
  ButtonExecuted(ButtonExecution)
  StringSelectExecuted(StringSelectExecution)
  UserSelectExecuted(UserSelectExecution)
  RoleSelectExecuted(RoleSelectExecution)
  MentionableSelectExecuted(MentionableSelectExecution)
  ChannelSelectExecuted(ChannelSelectExecution)
}

Constructors

pub type ModalResponse {
  ModalResponse(
    custom_id: String,
    title: String,
    components: List(modal.Component),
  )
}

Constructors

  • ModalResponse(
      custom_id: String,
      title: String,
      components: List(modal.Component),
    )
pub type ModalSubmission {
  ModalSubmission(
    custom_id: String,
    components: List(SubmittedModalComponent),
    resolved: option.Option(Resolved),
  )
}

Constructors

pub type ModifyFollowupFlag {
  ModifyFollowupWithSuppressedEmbeds
}

Constructors

  • ModifyFollowupWithSuppressedEmbeds
pub type ModifyOriginalResponseFlag {
  ModifyResponseWithSuppressedEmbeds
  ModifyResponseWithComponentsV2
}

Constructors

  • ModifyResponseWithSuppressedEmbeds
  • ModifyResponseWithComponentsV2
pub type Resolved {
  Resolved(
    users: option.Option(dict.Dict(String, user.User)),
    members: option.Option(
      dict.Dict(String, guild_member.GuildMember),
    ),
    roles: option.Option(dict.Dict(String, role.Role)),
    channels: option.Option(dict.Dict(String, ResolvedChannel)),
    messages: option.Option(dict.Dict(String, message.Message)),
    attachments: option.Option(
      dict.Dict(String, attachment.Attachment),
    ),
  )
}

Constructors

pub type ResolvedChannel {
  ResolvedTextChannel(
    id: String,
    name: String,
    current_user_permissions: List(permission.Permission),
  )
  ResolvedVoiceChannel(
    id: String,
    name: String,
    current_user_permissions: List(permission.Permission),
  )
  ResolvedCategoryChannel(
    id: String,
    name: String,
    current_user_permissions: List(permission.Permission),
  )
  ResolvedAnnouncementChannel(
    id: String,
    name: String,
    current_user_permissions: List(permission.Permission),
  )
  ResolvedAnnouncementThread(
    id: String,
    name: String,
    current_user_permissions: List(permission.Permission),
    metadata: thread.Metadata,
    parent_id: String,
  )
  ResolvedPublicThread(
    id: String,
    name: String,
    current_user_permissions: List(permission.Permission),
    metadata: thread.Metadata,
    parent_id: String,
  )
  ResolvedPrivateThread(
    id: String,
    name: String,
    current_user_permissions: List(permission.Permission),
    metadata: thread.Metadata,
    parent_id: String,
  )
  ResolvedStageChannel(
    id: String,
    name: String,
    current_user_permissions: List(permission.Permission),
  )
  ResolvedForumChannel(
    id: String,
    name: String,
    current_user_permissions: List(permission.Permission),
  )
  ResolvedMediaChannel(
    id: String,
    name: String,
    current_user_permissions: List(permission.Permission),
  )
}

Constructors

pub type Response {
  RespondWithChannelMessageWithSource(ResponseMessage)
  RespondWithDeferredChannelMessageWithSource(ResponseMessage)
  RespondWithDeferredUpdateMessage
  RespondWithUpdateMessage(ResponseMessage)
  RespondWithModal(ModalResponse)
}

Constructors

pub type ResponseMessage {
  ResponseMessage(
    is_tts: option.Option(Bool),
    content: option.Option(String),
    embeds: option.Option(List(embed.Embed)),
    allowed_mentions: option.Option(
      allowed_mentions.AllowedMentions,
    ),
    flags: option.Option(List(ResponseMessageFlag)),
    components: option.Option(List(message.Component)),
    attachments: option.Option(List(attachment.Create)),
    files: option.Option(List(file.File)),
    poll: option.Option(poll.Create),
  )
}

Constructors

pub type ResponseMessageFlag {
  ResponseMessageWithSuppressedEmbeds
  EphemeralResponseMessage
  ResponseMessageWithComponentsV2
  VoiceResponseMessage
  ResponseMessageWithSuppressedNotifications
}

Constructors

  • ResponseMessageWithSuppressedEmbeds
  • EphemeralResponseMessage
  • ResponseMessageWithComponentsV2
  • VoiceResponseMessage
  • ResponseMessageWithSuppressedNotifications
pub type RoleSelectExecution {
  RoleSelectExecution(
    custom_id: String,
    selected_roles_ids: List(String),
    resolved: option.Option(Resolved),
  )
}

Constructors

  • RoleSelectExecution(
      custom_id: String,
      selected_roles_ids: List(String),
      resolved: option.Option(Resolved),
    )
pub type SlashCommandExecution {
  SlashCommandExecution(
    id: String,
    name: String,
    resolved: option.Option(Resolved),
    options: List(SlashCommandOption),
    registered_to_guild_id: option.Option(String),
  )
}

Constructors

pub type SlashCommandOption {
  StringSlashCommandOption(
    name: String,
    value: String,
    is_focused: Bool,
  )
  IntegerSlashCommandOption(
    name: String,
    value: Int,
    is_focused: Bool,
  )
  NumberSlashCommandOption(
    name: String,
    value: Float,
    is_focused: Bool,
  )
  BoolSlashCommandOption(
    name: String,
    value: Bool,
    is_focused: Bool,
  )
  UserSlashCommandOption(
    name: String,
    user_id: String,
    is_focused: Bool,
  )
  ChannelSlashCommandOption(
    name: String,
    channel_id: String,
    is_focused: Bool,
  )
  RoleSlashCommandOption(
    name: String,
    role_id: String,
    is_focused: Bool,
  )
  MentionableSlashCommandOption(
    name: String,
    mentionable_id: String,
    is_focused: Bool,
  )
  AttachmentSlashCommandOption(
    name: String,
    attachment_id: String,
    is_focused: Bool,
  )
  SubCommandSlashCommandOption(
    name: String,
    options: List(SlashCommandOption),
  )
  SubCommandGroupSlashCommandOption(
    name: String,
    options: List(SlashCommandOption),
  )
}

Constructors

  • StringSlashCommandOption(
      name: String,
      value: String,
      is_focused: Bool,
    )

    Arguments

    is_focused

    For autocomplete.

  • IntegerSlashCommandOption(
      name: String,
      value: Int,
      is_focused: Bool,
    )

    Arguments

    is_focused

    For autocomplete.

  • NumberSlashCommandOption(
      name: String,
      value: Float,
      is_focused: Bool,
    )

    Arguments

    is_focused

    For autocomplete.

  • BoolSlashCommandOption(
      name: String,
      value: Bool,
      is_focused: Bool,
    )

    Arguments

    is_focused

    For autocomplete.

  • UserSlashCommandOption(
      name: String,
      user_id: String,
      is_focused: Bool,
    )

    Arguments

    name

    Name of the option, NOT of the user.

    is_focused

    For autocomplete.

  • ChannelSlashCommandOption(
      name: String,
      channel_id: String,
      is_focused: Bool,
    )

    Arguments

    name

    Name of the option, NOT of the channel.

    is_focused

    For autocomplete.

  • RoleSlashCommandOption(
      name: String,
      role_id: String,
      is_focused: Bool,
    )

    Arguments

    name

    Name of the option, NOT of the role.

    is_focused

    For autocomplete.

  • MentionableSlashCommandOption(
      name: String,
      mentionable_id: String,
      is_focused: Bool,
    )

    Arguments

    name

    Name of the option, NOT of the mentionable.

    is_focused

    For autocomplete.

  • AttachmentSlashCommandOption(
      name: String,
      attachment_id: String,
      is_focused: Bool,
    )

    Arguments

    name

    Name of the option, NOT of the attachment.

    attachment_id

    You likely want to search for this in resolved.

    is_focused

    For autocomplete.

  • SubCommandSlashCommandOption(
      name: String,
      options: List(SlashCommandOption),
    )
  • SubCommandGroupSlashCommandOption(
      name: String,
      options: List(SlashCommandOption),
    )
pub type StringSelectExecution {
  StringSelectExecution(
    custom_id: String,
    selected_values: List(String),
    resolved: option.Option(Resolved),
  )
}

Constructors

  • StringSelectExecution(
      custom_id: String,
      selected_values: List(String),
      resolved: option.Option(Resolved),
    )
pub type SubmittedLabelComponent {
  LabelTextInputSubmitted(TextInputSubmission)
  LabelStringSelectSubmitted(StringSelectExecution)
  LabelUserSelectSubmitted(UserSelectExecution)
  LabelRoleSelectSubmitted(RoleSelectExecution)
  LabelMentionableSelectSubmitted(MentionableSelectExecution)
  LabelChannelSelectSubmitted(ChannelSelectExecution)
  LabelFileUploadSubmitted(FileUploadSubmission)
}

Constructors

pub type SubmittedModalComponent {
  StringSelectSubmitted(StringSelectExecution)
  TextInputSubmitted(TextInputSubmission)
  UserSelectSubmitted(UserSelectExecution)
  RoleSelectSubmitted(RoleSelectExecution)
  MentionableSelectSubmitted(MentionableSelectExecution)
  ChannelSelectSubmitted(ChannelSelectExecution)
  TextDisplaySubmitted(TextDisplaySubmission)
  LabelSubmitted(LabelSubmission)
  FileUploadSubmitted(FileUploadSubmission)
}

Constructors

pub type TextDisplaySubmission {
  TextDisplaySubmission(id: Int)
}

Constructors

  • TextDisplaySubmission(id: Int)
pub type TextInputSubmission {
  TextInputSubmission(id: Int, custom_id: String, value: String)
}

Constructors

  • TextInputSubmission(id: Int, custom_id: String, value: String)
pub type UserCommandExecution {
  UserCommandExecution(
    id: String,
    name: String,
    resolved: option.Option(Resolved),
    registered_to_guild_id: option.Option(String),
    user_id: String,
  )
}

Constructors

pub type UserSelectExecution {
  UserSelectExecution(
    custom_id: String,
    selected_users_ids: List(String),
    resolved: option.Option(Resolved),
  )
}

Constructors

  • UserSelectExecution(
      custom_id: String,
      selected_users_ids: List(String),
      resolved: option.Option(Resolved),
    )

Values

pub fn delete_followup(
  client: grom.Client,
  of interaction: Interaction,
  id message_id: String,
) -> Result(Nil, grom.Error)
pub fn delete_original_response(
  client: grom.Client,
  of interaction: Interaction,
) -> Result(Nil, grom.Error)
pub fn followup(
  client: grom.Client,
  to interaction: Interaction,
  using followup: Followup,
) -> Result(message.Message, grom.Error)

Do not use this function to send a message after deferring it. Use modify_original_response instead.

pub fn get_followup(
  client: grom.Client,
  for interaction: Interaction,
  id message_id: String,
) -> Result(message.Message, grom.Error)
pub fn get_original_response(
  client: grom.Client,
  for interaction: Interaction,
) -> Result(Response, grom.Error)
pub fn modify_followup(
  client: grom.Client,
  for interaction: Interaction,
  id message_id: String,
  using modify: ModifyFollowup,
) -> Result(message.Message, grom.Error)
pub fn modify_original_response(
  client: grom.Client,
  of interaction: Interaction,
  using modify: ModifyOriginalResponse,
) -> Result(message.Message, grom.Error)
pub fn new_followup() -> Followup
pub fn new_modify_followup() -> ModifyFollowup
pub fn new_modify_original_response() -> ModifyOriginalResponse
pub fn new_response_message() -> ResponseMessage
pub fn respond(
  client: grom.Client,
  to interaction: Interaction,
  using response: Response,
) -> Result(Nil, grom.Error)
Search Document