Nostrum.Struct.Interaction (nostrum v0.11.0-dev)

View Source

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

application_id()

(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.

channel()

(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.

channel_id()

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

ID of the channel where the command was invoked

data()

Invocation data.

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

guild_id()

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

ID of the guild where the command was invoked

guild_locale()

(since 0.6.0)
@type guild_locale() :: String.t() | nil

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

id()

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

Interaction identifier

locale()

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

The selected langauge of the invoking user.

Available on all interaction types except for PING

member()

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

Member information about the invoker, if invoked on a guild

message()

(since 0.5.0)
@type message() :: Nostrum.Struct.Message.t() | nil

For components, the message they were attached to

t()

@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

token()

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

Continuation token for responses

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

type()

@type type() :: 1..5

Interaction kind.

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

user()

(since 0.5.0)
@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

version()

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

Version identifier, always 1

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