View Source Nostrum.Struct.Interaction (Nostrum v0.6.1)

Application command and Component invocation struct.

Link to this section Summary

Types

ID of the application that this interaction is for

ID of the channel where the command was invoked

Invocation data.

ID of the guild where the command was invoked

The guild's preferred locale, if invoked in a guild.

Interaction identifier

The selected langauge of the invoking user.

Member information about the invoker, if invoked on a guild

For components, the message they were attached to

t()

A command invocation for Application Commands or Components.

Continuation token for responses

Interaction kind.

User object for the invoking user, will be a copy of member.user if invoked in a guild

Version identifier, always 1

Link to this section Types

Link to this type

application_id()

View Source (since 0.5.0)

Specs

application_id() :: Nostrum.Snowflake.t() | nil

ID of the application that this interaction is for

Will be nil if the interaction was part of a message struct.

Specs

channel_id() :: Nostrum.Struct.Channel.id()

ID of the channel where the command was invoked

Specs

Invocation data.

Only present for ApplicationCommand and MessageComponent interactions, that is, type=2 or type=3.

Specs

guild_id() :: Nostrum.Struct.Guild.id() | nil

ID of the guild where the command was invoked

Link to this type

guild_locale()

View Source (since 0.6.0)

Specs

guild_locale() :: String.t() | nil

The guild's preferred locale, if invoked in a guild.

Specs

Interaction identifier

Link to this type

locale()

View Source (since 0.6.0)

Specs

locale() :: String.t() | nil

The selected langauge of the invoking user.

Available on all interaction types except for PING

Specs

member() :: Nostrum.Struct.Guild.Member.t() | nil

Member information about the invoker, if invoked on a guild

Link to this type

message()

View Source (since 0.5.0)

Specs

message() :: Nostrum.Struct.Message.t() | nil

For components, the message they were attached to

Specs

t() :: %Nostrum.Struct.Interaction{
  application_id: application_id(),
  channel_id: channel_id(),
  data: data(),
  guild_id: guild_id(),
  guild_locale: guild_locale(),
  id: id(),
  locale: locale(),
  member: member(),
  message: message(),
  token: token(),
  type: type(),
  user: user(),
  version: version()
}

A command invocation for Application Commands or Components.

Official reference: https://discord.com/developers/docs/interactions/application-commands

Specs

token() :: String.t() | nil

Continuation token for responses

Will be nil if this interaction is part of a message struct.

Specs

type() :: 1..5

Interaction kind.

  • 1 for Ping
  • 2 for ApplicationCommand
  • 3 for MessageComponent
  • 4 for ApplicationCommandAutocomplete
  • 5 for ModalSubmit

Specs

user() :: Nostrum.Struct.User.t() | nil

User object for the invoking user, will be a copy of member.user if invoked in a guild

Specs

version() :: pos_integer() | nil

Version identifier, always 1

Will be nil if this interaction is part of a message struct.