grom/interaction
Types
pub type ButtonExecution {
ButtonExecution(
custom_id: String,
resolved: option.Option(Resolved),
)
}
Constructors
-
ButtonExecution( custom_id: String, resolved: option.Option(Resolved), )
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
-
SlashCommandExecuted(SlashCommandExecution) -
MessageCommandExecuted(MessageCommandExecution) -
UserCommandExecuted(UserCommandExecution)
pub type Context {
TriggeredInGuild
TriggeredInBotDms
TriggeredInPrivateChannel
}
Constructors
-
TriggeredInGuild -
TriggeredInBotDms -
TriggeredInPrivateChannel
pub type Data {
CommandExecuted(CommandExecution)
MessageComponentExecuted(MessageComponentExecution)
ModalSubmitted(ModalSubmission)
}
Constructors
-
CommandExecuted(CommandExecution) -
MessageComponentExecuted(MessageComponentExecution) -
ModalSubmitted(ModalSubmission)
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
-
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), )
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
-
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, )Arguments
- message
-
For modals/component interactions, the message it was triggered from.
pub type InvokementInfo {
InvokedInGuild(
guild_id: String,
member: guild_member.GuildMember,
guild_locale: String,
)
InvokedInDm(user: user.User)
}
Constructors
-
InvokedInGuild( guild_id: String, member: guild_member.GuildMember, guild_locale: String, ) -
InvokedInDm(user: user.User)
pub type LabelSubmission {
LabelSubmission(id: Int, component: SubmittedLabelComponent)
}
Constructors
-
LabelSubmission(id: Int, component: SubmittedLabelComponent)
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
-
MessageCommandExecution( id: String, name: String, resolved: option.Option(Resolved), registered_to_guild_id: option.Option(String), message_id: String, )
pub type MessageComponentExecution {
ButtonExecuted(ButtonExecution)
StringSelectExecuted(StringSelectExecution)
UserSelectExecuted(UserSelectExecution)
RoleSelectExecuted(RoleSelectExecution)
MentionableSelectExecuted(MentionableSelectExecution)
ChannelSelectExecuted(ChannelSelectExecution)
}
Constructors
-
ButtonExecuted(ButtonExecution) -
StringSelectExecuted(StringSelectExecution) -
UserSelectExecuted(UserSelectExecution) -
RoleSelectExecuted(RoleSelectExecution) -
MentionableSelectExecuted(MentionableSelectExecution) -
ChannelSelectExecuted(ChannelSelectExecution)
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
-
ModalSubmission( custom_id: String, components: List(SubmittedModalComponent), resolved: option.Option(Resolved), )
pub type ModifyFollowup {
ModifyFollowup(
content: modification.Modification(String),
embeds: modification.Modification(List(embed.Embed)),
flags: modification.Modification(List(ModifyFollowupFlag)),
allowed_mentions: modification.Modification(
allowed_mentions.AllowedMentions,
),
components: modification.Modification(List(message.Component)),
files: modification.Modification(List(file.File)),
attachments: modification.Modification(
List(attachment.Create),
),
poll: modification.Modification(poll.Create),
)
}
Constructors
-
ModifyFollowup( content: modification.Modification(String), embeds: modification.Modification(List(embed.Embed)), flags: modification.Modification(List(ModifyFollowupFlag)), allowed_mentions: modification.Modification( allowed_mentions.AllowedMentions, ), components: modification.Modification(List(message.Component)), files: modification.Modification(List(file.File)), attachments: modification.Modification(List(attachment.Create)), poll: modification.Modification(poll.Create), )
pub type ModifyFollowupFlag {
ModifyFollowupWithSuppressedEmbeds
}
Constructors
-
ModifyFollowupWithSuppressedEmbeds
pub type ModifyOriginalResponse {
ModifyOriginalResponse(
content: modification.Modification(String),
embeds: modification.Modification(List(embed.Embed)),
flags: modification.Modification(
List(ModifyOriginalResponseFlag),
),
allowed_mentions: modification.Modification(
allowed_mentions.AllowedMentions,
),
components: modification.Modification(List(message.Component)),
files: modification.Modification(List(file.File)),
attachments: modification.Modification(
List(attachment.Create),
),
poll: modification.Modification(poll.Create),
)
}
Constructors
-
ModifyOriginalResponse( content: modification.Modification(String), embeds: modification.Modification(List(embed.Embed)), flags: modification.Modification( List(ModifyOriginalResponseFlag), ), allowed_mentions: modification.Modification( allowed_mentions.AllowedMentions, ), components: modification.Modification(List(message.Component)), files: modification.Modification(List(file.File)), attachments: modification.Modification(List(attachment.Create)), poll: modification.Modification(poll.Create), )
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
-
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), ), )
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
-
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), )
pub type Response {
RespondWithChannelMessageWithSource(ResponseMessage)
RespondWithDeferredChannelMessageWithSource(ResponseMessage)
RespondWithDeferredUpdateMessage
RespondWithUpdateMessage(ResponseMessage)
RespondWithModal(ModalResponse)
}
Constructors
-
RespondWithChannelMessageWithSource(ResponseMessage) -
RespondWithDeferredChannelMessageWithSource(ResponseMessage)You should only set the
flagsproperty in this response. -
RespondWithDeferredUpdateMessage -
RespondWithUpdateMessage(ResponseMessage) -
RespondWithModal(ModalResponse)
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
-
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), )Arguments
- flags
-
For
RespondWithDeferredChannelMessageWithSources, you can only set theEphemeralResponseMessageflag. If you need any other flags - use them with the edited response message.
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
-
SlashCommandExecution( id: String, name: String, resolved: option.Option(Resolved), options: List(SlashCommandOption), registered_to_guild_id: option.Option(String), )
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
-
LabelTextInputSubmitted(TextInputSubmission) -
LabelStringSelectSubmitted(StringSelectExecution) -
LabelUserSelectSubmitted(UserSelectExecution) -
LabelRoleSelectSubmitted(RoleSelectExecution) -
LabelMentionableSelectSubmitted(MentionableSelectExecution) -
LabelChannelSelectSubmitted(ChannelSelectExecution) -
LabelFileUploadSubmitted(FileUploadSubmission)
pub type SubmittedModalComponent {
StringSelectSubmitted(StringSelectExecution)
TextInputSubmitted(TextInputSubmission)
UserSelectSubmitted(UserSelectExecution)
RoleSelectSubmitted(RoleSelectExecution)
MentionableSelectSubmitted(MentionableSelectExecution)
ChannelSelectSubmitted(ChannelSelectExecution)
TextDisplaySubmitted(TextDisplaySubmission)
LabelSubmitted(LabelSubmission)
FileUploadSubmitted(FileUploadSubmission)
}
Constructors
-
StringSelectSubmitted(StringSelectExecution) -
TextInputSubmitted(TextInputSubmission) -
UserSelectSubmitted(UserSelectExecution) -
RoleSelectSubmitted(RoleSelectExecution) -
MentionableSelectSubmitted(MentionableSelectExecution) -
ChannelSelectSubmitted(ChannelSelectExecution) -
TextDisplaySubmitted(TextDisplaySubmission) -
LabelSubmitted(LabelSubmission) -
FileUploadSubmitted(FileUploadSubmission)
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
-
UserCommandExecution( id: String, name: String, resolved: option.Option(Resolved), registered_to_guild_id: option.Option(String), user_id: String, )
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)