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

pub struct GetMessages(pub HashMap<&'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

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)
})?;

Methods

impl GetMessages[src]

pub fn after<M: Into<MessageId>>(&mut self, message_id: M) -> &mut Self[src]

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

pub fn around<M: Into<MessageId>>(&mut self, message_id: M) -> &mut Self[src]

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

pub fn before<M: Into<MessageId>>(&mut self, message_id: M) -> &mut Self[src]

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

pub fn limit(&mut self, limit: u64) -> &mut Self[src]

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

impl Default for GetMessages[src]

impl Clone for GetMessages[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for GetMessages[src]

Auto Trait Implementations

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Erased for T

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Err = <U as TryFrom<T>>::Err

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