Struct serenity::builder::GetMessages[][src]

pub struct GetMessages(pub HashMap<&'static str, u64>);
Expand description

Builds a request to the API to retrieve messages.

This can have 2 different sets of parameters. The first set is around where to get the messages:

These can not be mixed, and the first in the list alphabetically will be used. If one is not specified, most_recent will be used.

The fourth parameter is to specify the number of messages to retrieve. This does not need to be called and defaults to a value of 50.

This should be used only for retrieving messages; see GuildChannel::messages for examples.

Examples

Creating a GetMessages builder to retrieve the first 25 messages after the message with an Id of 158339864557912064:

use serenity::model::id::{ChannelId, MessageId};

// you can then pass it into a function which retrieves messages:
let channel_id = ChannelId(81384788765712384);

let _messages = channel_id
    .messages(&http, |retriever| retriever.after(MessageId(158339864557912064)).limit(25))
    .await?;

Tuple Fields

0: HashMap<&'static str, u64>

Implementations

Indicates to retrieve the messages after a specific message, given by its Id.

Indicates to retrieve the messages around a specific message in either direction (before+after) the given message.

Indicates to retrieve the messages before a specific message, given by its Id.

The maximum number of messages to retrieve for the query.

If this is not specified, a default value of 50 is used.

Note: This field is capped to 100 messages due to a Discord limitation. If an amount larger than 100 is supplied, it will be reduced.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more