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

A Nostrum.Struct.Message represents a message.

More information can be found on the Discord API Message Object Documentation.

Link to this section Summary

Types

The activity of the message. Sent with Rich Presence-related chat embeds

The application of the message. Sent with Rich Presence-related chat embeds

if the message is a response to an interaction, this is the ID of the interaction's application

List of attached files in the message

The user struct of the author

The id of the channel

List of Message Components

The content of the message

When the message was edited

List of embedded content in the message

The id of the guild

The id of the message

Message interaction object

Partial Guild Member object received with the Message Create event if message came from a guild channel

List of channels mentioned in the message

Whether this message mentions everyone

List of roles ids mentioned in the message

List of users mentioned in the message

Reference data sent with crossposted messages and replies.

Validates if a message was sent

Whether this message is pinned

Reactions to the message.

The message associated with the :message_reference

Array of Message Sticker Item Objects

t()

The thread that was started from this message, includes a thread member object

When the message was sent

Whether this was a TTS message

If the message is generated by a webhook, this is the webhook's id

Functions

Takes the message and produces a URL that, when clicked from the user client, will jump them to that message, assuming they have access to the message and the message is valid.

Link to this section Types

Specs

activity() :: Nostrum.Struct.Message.Activity.t() | nil

The activity of the message. Sent with Rich Presence-related chat embeds

Specs

application() :: Nostrum.Struct.Message.Application.t() | nil

The application of the message. Sent with Rich Presence-related chat embeds

Specs

application_id() :: Nostrum.Struct.Message.Application.id() | nil

if the message is a response to an interaction, this is the ID of the interaction's application

Specs

List of attached files in the message

Specs

author() :: Nostrum.Struct.User.t()

The user struct of the author

Specs

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

The id of the channel

Specs

List of Message Components

Specs

content() :: String.t()

The content of the message

Specs

edited_timestamp() :: DateTime.t() | nil

When the message was edited

Specs

embeds() :: [Nostrum.Struct.Embed.t()]

List of embedded content in the message

Specs

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

The id of the guild

Specs

The id of the message

Specs

interaction() :: Nostrum.Struct.Interaction.t()

Message interaction object

Specs

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

Partial Guild Member object received with the Message Create event if message came from a guild channel

Specs

mention_channels() :: [Nostrum.Struct.Channel.channel_mention()]

List of channels mentioned in the message

Discord API Channel Mention Object Documentation

Specs

mention_everyone() :: boolean()

Whether this message mentions everyone

Specs

mention_roles() :: [Nostrum.Struct.Guild.Role.id()]

List of roles ids mentioned in the message

Specs

mentions() :: [Nostrum.Struct.User.t()]

List of users mentioned in the message

Specs

message_reference() :: Nostrum.Struct.Message.Reference.t() | nil

Reference data sent with crossposted messages and replies.

For THREAD_STARTER_MESSAGE messages, this field points to the message that the thread was started from.

Specs

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

Validates if a message was sent

Specs

pinned() :: boolean()

Whether this message is pinned

Specs

reactions() :: [Nostrum.Struct.Message.Reaction.t()] | nil

Reactions to the message.

Specs

referenced_message() :: t() | nil

The message associated with the :message_reference

This field is only returned for messages with a type: 19 (Reply). If the message is a reply but the:referenced_message field is not present, the backend did not attempt to fetch the message that was being replied to,so its state is unknown. If the field exists but is nil, the referenced message was deleted.

Specs

sticker_items() :: [Nostrum.Struct.Message.Sticker.t()]

Array of Message Sticker Item Objects

Specs

t() :: %Nostrum.Struct.Message{
  activity: activity(),
  application: application(),
  application_id: application_id(),
  attachments: attachments(),
  author: author(),
  channel_id: channel_id(),
  components: components(),
  content: content(),
  edited_timestamp: edited_timestamp(),
  embeds: embeds(),
  guild_id: guild_id(),
  id: id(),
  interaction: interaction(),
  member: member(),
  mention_channels: term(),
  mention_everyone: mention_everyone(),
  mention_roles: mention_roles(),
  mentions: mentions(),
  message_reference: message_reference(),
  nonce: nonce(),
  pinned: pinned(),
  reactions: reactions(),
  referenced_message: referenced_message(),
  sticker_items: sticker_items(),
  thread: thread(),
  timestamp: timestamp(),
  tts: tts(),
  type: type(),
  webhook_id: webhook_id()
}

Specs

thread() :: Nostrum.Struct.Channel.t() | nil

The thread that was started from this message, includes a thread member object

Specs

timestamp() :: DateTime.t()

When the message was sent

Specs

tts() :: boolean()

Whether this was a TTS message

Specs

type() :: integer()

Discord API Message Object Type Documentation

  • 0 - DEFAULT
  • 1 - RECIPIENT_ADD
  • 2 - RECIPIENT_REMOVE
  • 3 - CALL
  • 4 - CHANNEL_NAME_CHANGE
  • 5 - CHANNEL_ICON_CHANGE
  • 6 - CHANNEL_PINNED_MESSAGE
  • 7 - GUILD_MEMBER_JOIN
  • 8 - USER_PREMIUM_GUILD_SUBSCRIPTION
  • 9 - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_1
  • 10 - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_2
  • 11 - USER_PREMIUM_GUILD_SUBSCRIPTION_TIER_3
  • 12 - CHANNEL_FOLLOW_ADD
  • 14 - GUILD_DISCOVERY_DISQUALIFIED
  • 15 - GUILD_DISCOVERY_REQUALIFIED
  • 16 - GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING
  • 17 - GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING
  • 18 - THREAD_CREATED
  • 19 - REPLY
  • 20 - APPLICATION_COMMAND
  • 21 - THREAD_STARTER_MESSAGE
  • 22 - GUILD_INVITE_REMINDER

Specs

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

If the message is generated by a webhook, this is the webhook's id

Link to this section Functions

Link to this function

to_url(message)

View Source (since 0.5.0)

Specs

to_url(%Nostrum.Struct.Message{
  activity: term(),
  application: term(),
  application_id: term(),
  attachments: term(),
  author: term(),
  channel_id: term(),
  components: term(),
  content: term(),
  edited_timestamp: term(),
  embeds: term(),
  guild_id: term(),
  id: term(),
  interaction: term(),
  member: term(),
  mention_channels: term(),
  mention_everyone: term(),
  mention_roles: term(),
  mentions: term(),
  message_reference: term(),
  nonce: term(),
  pinned: term(),
  reactions: term(),
  referenced_message: term(),
  sticker_items: term(),
  thread: term(),
  timestamp: term(),
  tts: term(),
  type: term(),
  webhook_id: term()
}) :: String.t()

Takes the message and produces a URL that, when clicked from the user client, will jump them to that message, assuming they have access to the message and the message is valid.