Struct serenity::model::Message [] [src]

pub struct Message {
    pub id: MessageId,
    pub attachments: Vec<Attachment>,
    pub author: User,
    pub channel_id: ChannelId,
    pub content: String,
    pub edited_timestamp: Option<String>,
    pub embeds: Vec<Embed>,
    pub hit: bool,
    pub kind: MessageType,
    pub mention_everyone: bool,
    pub mention_roles: Vec<RoleId>,
    pub mentions: Vec<User>,
    pub nonce: Option<String>,
    pub pinned: bool,
    pub reactions: Vec<MessageReaction>,
    pub timestamp: String,
    pub tts: bool,
    pub webhook_id: Option<WebhookId>,
}

A representation of a message sent over a guild's text channel, a group, or a private channel.

Fields

Message Id. Can be used to calculate the message creation date.

Array of attached files a message has.

User that sent the message.

Channel to which the message was sent.

Message's content.

If the message was edited, this will show the last edit timestamp.

Array of embeds a message has.

Whether the message is the "found" message in a search. Note that this is only relevant in the context of searches, and will otherwise always be false.

Lets you differentiate system messages and regular messages.

Shows you whether this message actually mentions everyone or not.

Array of roles mentioned by the message.

Array of users mentioned by the messages.

Non-repeating number used for ensuring message order.

True if message is pinned.

Array of reactions performed on the message.

Initial message creation timestamp calculated from Id.

True if message was sent with /tts command.

An id of a webhook if message was sent using one.

Methods

impl Message
[src]

Marks the Channel as being read up to the message.

Refer to the documentation for rest::ack_message for more information.

Errors

If the cache is enabled, returns a ClientError::InvalidOperationAsBot if the current user is a bot user.

Deletes the message.

Note: The logged in user must either be the author of the message or have the Manage Messages permission.

Errors

If the cache feature is enabled, then returns a ClientError::InvalidPermissions if the current user does not have the required permissions.

Deletes all of the Reactions associated with the message.

Note: Requires the Manage Messages permission.

Errors

If the cache feature is enabled, then returns a ClientError::InvalidPermissions if the current user does not have the required permissions.

Edits this message, replacing the original content with new content.

If editing a message and not using an embed, just return the embed builder directly, via:

message.edit("new content", |f| f);

Note: You must be the author of the message to be able to do this.

Note: Messages must be at most 2000 unicode code points.

Errors

If the cache is enabled, returns a ClientError::InvalidUser if the current user is not the author.

Returns a ClientError::MessageTooLong if the content of the message is over the above limit, containing the number of unicode code points over the limit.

Returns message content, but with user and role mentions replaced with names and everyone/here mentions cancelled.

Gets the list of Users who have reacted to a Message with a certain Emoji.

The default limit is 50 - specify otherwise to receive a different maximum number of users. The maximum that may be retrieve at a time is 100, if a greater number is provided then it is automatically reduced.

The optional after attribute is to retrieve the users after a certain user. This is useful for pagination.

Note: Requires the Read Message History permission.

Retrieves the Id of the guild that the message was sent in, if sent in one.

Returns None if the channel data or guild data does not exist in the cache.

True if message was sent using direct messages.

Checks the length of a string to ensure that it is within Discord's maximum message length limit.

Returns None if the message is within the limit, otherwise returns Some with an inner value of how many unicode code points the message is over.

Pins this message to its channel.

Note: Requires the Manage Messages permission.

Errors

If the cache is enabled, returns a ClientError::InvalidPermissions if the current user does not have the required permissions.

React to the message with a custom Emoji or unicode character.

Note: Requires the Add Reactions permission.

Errors

If the cache is enabled, returns a ClientError::InvalidPermissions if the current user does not have the required permissions.

Replies to the user, mentioning them prior to the content in the form of: @<USER_ID>: YOUR_CONTENT.

User mentions are generally around 20 or 21 characters long.

Note: Requires the Send Messages permission.

Note: Message contents must be under 2000 unicode code points.

Errors

If the cache is enabled, returns a ClientError::InvalidPermissions if the current user does not have the required permissions.

Returns a ClientError::MessageTooLong if the content of the message is over the above limit, containing the number of unicode code points over the limit.

Unpins the message from its channel.

Note: Requires the Manage Messages permission.

Errors

If the cache is enabled, returns a ClientError::InvalidPermissions if the current user does not have the required permissions.

Trait Implementations

impl Clone for Message
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Message
[src]

Formats the value using the given formatter.