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

pub struct GetMessages(pub VecMap<&'static str, u64>);

Builds a request for 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:

  • after
  • around
  • before
  • most_recent

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::builder::GetMessages;
use serenity::model::id::{ChannelId, MessageId};

let retriever = GetMessages::default()
    .after(MessageId(158339864557912064))
    .limit(25);

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

let _messages = channel_id.messages(|_| retriever)?;

Methods

impl GetMessages
[src]

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.

This is a function that is here for completeness. You do not need to call this - except to clear previous calls to after, around, and before - as it is the default value.

Trait Implementations

impl Default for GetMessages
[src]

Returns the "default value" for a type. Read more

impl Clone for GetMessages
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for GetMessages
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for GetMessages

impl Sync for GetMessages

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

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

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

recently added

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

impl<T> From for T
[src]

Performs the conversion.

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T> Borrow for T where
    T: ?Sized
[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut for T where
    T: ?Sized
[src]

Mutably borrows from an owned value. Read more

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

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

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more

impl<T> Erased for T

impl<T> Typeable for T where
    T: Any

Get the TypeId of this object.

impl<T> DebugAny for T where
    T: Any + Debug
[src]

impl<T> CloneAny for T where
    T: Clone + Any
[src]

impl<T> UnsafeAny for T where
    T: Any