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

Application command and Component invocation struct.

Summary

Types

ID of the application that this interaction is for

PartialChannel object for the channel where the command was invoked

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

Types

Link to this type

application_id()

View Source (since 0.5.0)
@type 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.

Link to this type

channel()

View Source (since 0.8.0)
@type channel() :: Nostrum.Struct.Channel.t() | nil

PartialChannel object for the channel where the command was invoked

At the time of writing, only the fields :type and :id are guaranteed to be present.

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

ID of the channel where the command was invoked

Invocation data.

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

@type 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)
@type guild_locale() :: String.t() | nil

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

@type id() :: Nostrum.Snowflake.t()

Interaction identifier

Link to this type

locale()

View Source (since 0.6.0)
@type locale() :: String.t() | nil

The selected langauge of the invoking user.

Available on all interaction types except for PING

@type 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)
@type message() :: Nostrum.Struct.Message.t() | nil

For components, the message they were attached to

@type t() :: %Nostrum.Struct.Interaction{
  application_id: application_id(),
  channel: channel(),
  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

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

Continuation token for responses

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

@type type() :: 1..5

Interaction kind.

  • 1 for Ping
  • 2 for ApplicationCommand
  • 3 for MessageComponent
  • 4 for ApplicationCommandAutocomplete
  • 5 for ModalSubmit
@type user() :: Nostrum.Struct.User.t() | nil

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

@type version() :: pos_integer() | nil

Version identifier, always 1

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