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

View Source

A Nostrum.Struct.Message represents a message.

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

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

The poll object attached to the message

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.

Types

activity()

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

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

application()

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

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

application_id()

@type 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

attachments()

@type attachments() :: [Nostrum.Struct.Message.Attachment.t()]

List of attached files in the message

author()

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

The user struct of the author

channel_id()

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

The id of the channel

components()

@type components() :: [Nostrum.Struct.Message.Component.t()]

List of Message Components

content()

@type content() :: String.t()

The content of the message

edited_timestamp()

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

When the message was edited

embeds()

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

List of embedded content in the message

guild_id()

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

The id of the guild

id()

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

The id of the message

interaction()

@type interaction() :: Nostrum.Struct.Interaction.t() | nil

Message interaction object

member()

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

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

mention_channels()

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

List of channels mentioned in the message

Discord API Channel Mention Object Documentation

mention_everyone()

@type mention_everyone() :: boolean()

Whether this message mentions everyone

mention_roles()

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

List of roles ids mentioned in the message

mentions()

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

List of users mentioned in the message

message_reference()

@type 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.

nonce()

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

Validates if a message was sent

pinned()

@type pinned() :: boolean()

Whether this message is pinned

poll()

@type poll() :: Nostrum.Struct.Message.Poll.t() | nil

The poll object attached to the message

reactions()

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

Reactions to the message.

referenced_message()

@type 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.

sticker_items()

@type sticker_items() :: [Nostrum.Struct.Sticker.t()]

Array of Message Sticker Item Objects

t()

@type 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(),
  poll: poll(),
  reactions: reactions(),
  referenced_message: referenced_message(),
  sticker_items: sticker_items(),
  thread: thread(),
  timestamp: timestamp(),
  tts: tts(),
  type: type(),
  webhook_id: webhook_id()
}

thread()

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

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

timestamp()

@type timestamp() :: DateTime.t()

When the message was sent

tts()

@type tts() :: boolean()

Whether this was a TTS message

type()

@type 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 - GUILD_BOOST
  • 9 - GUILD_BOOST_TIER_1
  • 10 - GUILD_BOOST_TIER_2
  • 11 - GUILD_BOOST_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 - CHAT_INPUT_COMMAND
  • 21 - THREAD_STARTER_MESSAGE
  • 22 - GUILD_INVITE_REMINDER
  • 23 - CONTEXT_MENU_COMMAND
  • 24 - AUTO_MODERATION_ACTION
  • 25 - ROLE_SUBSCRIPTION_PURCHASE
  • 26 - INTERACTION_PREMIUM_UPSELL
  • 27 - STAGE_START
  • 28 - STAGE_END
  • 29 - STAGE_SPEAKER
  • 31 - STAGE_TOPIC
  • 32 - GUILD_APPLICATION_PREMIUM_SUBSCRIPTION
  • 36 - GUILD_INCIDENT_ALERT_MODE_ENABLED
  • 37 - GUILD_INCIDENT_ALERT_MODE_DISABLED
  • 38 - GUILD_INCIDENT_REPORT_RAID
  • 39 - GUILD_INCIDENT_REPORT_FALSE_ALARM
  • 44 - PURCHASE_NOTIFICATION
  • 46 - POLL_RESULT

webhook_id()

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

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

Functions

to_url(message)

(since 0.5.0)
@spec 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(),
  poll: 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.