alchemy v0.6.0 Alchemy.Message

This module contains the types and functions related to messages in discord.

Summary

Types

Represents an emoji used to react to a message

Represents a reaction to a message

t()

Represents a message in a channel

Represents an iso8601 timestamp

Functions

Finds a list of mentions in a string

Types

emoji :: %Alchemy.Reaction.Emoji{id: String.t | nil, name: String.t}

Represents an emoji used to react to a message.

  • id The id of this emoji. nil if this isn’t a custom emoji.
  • name The name of this emoji.
mention_type :: :roles | :nicknames | :channels | :users
reaction :: %Alchemy.Reaction{count: Integer, emoji: Alchemy.Reaction.Emoji.t, me: Boolean}

Represents a reaction to a message.

  • count Times this specific emoji reaction has been used.
  • me Whether this client reacted to the message.
  • emoji Information about the emoji used.
t :: %Alchemy.Message{attachments: [Alchemy.Attachment.t], author: Alchemy.User.t, channel_id: snowflake, content: String, edited_timestamp: String | nil, embeds: [Alchemy.Embed.t], id: snowflake, mention_everyone: Boolean, mention_roles: [snowflake], mentions: [Alchemy.User.t], nonce: snowflake, pinned: Boolean, reactions: [Alchemy.Reaction.t], timestamp: timestamp, tts: Boolean, webhook_id: String.t | nil}

Represents a message in a channel.

  • id The id of this message.
  • author The user who sent this message. This field will be very incomplete if the message originated from a webhook.
  • content The content of the message.
  • timestamp The timestamp of the message.
  • edit_timestamp The timestamp of when this message was edited, if it ever was.
  • tts Whether this was a tts message.
  • mention_everyone Whether this message mentioned everyone.
  • mentions A list of users this message mentioned.
  • mention_roles A list of role ids this message mentioned.
  • attachments A list of attachments to the message.
  • embeds A list of embeds attached to this message.
  • reactions A list of reactions to this message.
  • nonce Used for validating a message was sent.
  • pinned Whether this message is pinned.
  • webhook_id The id of the webhook that sent this message, if it was sent by a webhook.
timestamp :: String.t

Represents an iso8601 timestamp.

Functions

find_mentions(content, type)

Specs

find_mentions(String.t, mention_type) :: [snowflake]

Finds a list of mentions in a string.

4 types of mentions exist:

  • roles A mention of a specific role.
  • nicknames A mention of a user by nickname.
  • users A mention of a user by name, or nickname.
  • :channels A mention of a channel.