Crux v2020-03-17 17:55:51Z Crux.Structs.Message View Source

Represents a Discord Message Object.

Differences opposed to the Discord API Object:

  • :mentions is a MapSet of user ids

Link to this section Summary

Types

All available types that can be resolved into a message id.

  • message_id is nil for the initial message sent when a user starts following a channel.
  • guild_id is only nil for some messages during the initial rollout of this feature.
t()

Functions

Creates a Crux.Structs.Message.t/0 struct from raw data.

Link to this section Types

Link to this type

id_resolvable() View Source (since 0.2.1)

All available types that can be resolved into a message id.

Link to this type

mention_channel() View Source (since 0.2.1)
mention_channel() :: %{
  id: Crux.Structs.Snowflake.t(),
  guild_id: Crux.Structs.Snowflake.t(),
  name: String.t(),
  type: non_neg_integer()
}

Link to this type

message_activity() View Source (since 0.2.1)
message_activity() :: %{optional(:party_id) => String.t(), :type => integer()}

Link to this type

message_application() View Source (since 0.2.1)
message_application() :: %{
  id: Crux.Structs.Snowflake.t(),
  cover_image: String.t() | nil,
  description: String.t(),
  icon: String.t() | nil,
  name: String.t()
}

Link to this type

message_reference() View Source (since 0.2.1)
message_reference() :: %{
  message_id: Crux.Structs.Snowflake.t() | nil,
  guild_id: Crux.Structs.Snowflake.t() | nil,
  channel_id: Crux.Structs.Snowflake.t()
}

  • message_id is nil for the initial message sent when a user starts following a channel.
  • guild_id is only nil for some messages during the initial rollout of this feature.
Link to this type

t() View Source (since 0.1.0)
t() :: %Crux.Structs.Message{
  activity: message_activity() | nil,
  application: message_application() | nil,
  attachments: [Crux.Structs.Attachment.t()],
  author: Crux.Structs.User.t(),
  channel_id: Crux.Structs.Snowflake.t(),
  content: String.t(),
  edited_timestamp: String.t(),
  embeds: [Crux.Structs.Embed.t()],
  flags: non_neg_integer(),
  guild_id: Crux.Structs.Snowflake.t() | nil,
  id: Crux.Structs.Snowflake.t(),
  member: Crux.Structs.Member.t() | nil,
  mention_channels: [mention_channel()],
  mention_everyone: boolean(),
  mention_roles: MapSet.t(Crux.Structs.Snowflake.t()),
  mentions: MapSet.t(Crux.Structs.Snowflake.t()),
  message_reference: message_reference(),
  nonce: String.t() | nil,
  pinned: boolean(),
  reactions: %{required(String.t()) => Crux.Structs.Reaction.t()},
  timestamp: String.t(),
  tts: boolean(),
  type: integer(),
  webhook_id: Crux.Structs.Snowflake.t() | nil
}

Link to this section Functions

Link to this function

create(data) View Source (since 0.1.0)
create(data :: map()) :: t()

Creates a Crux.Structs.Message.t/0 struct from raw data.

Automatically invoked by Crux.Structs.create/2.