Struct serenity::builder::GetMessages [−][src]
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]
impl GetMessages
pub fn after<M: Into<MessageId>>(self, message_id: M) -> Self
[src]
pub fn after<M: Into<MessageId>>(self, message_id: M) -> Self
Indicates to retrieve the messages after a specific message, given by its Id.
pub fn around<M: Into<MessageId>>(self, message_id: M) -> Self
[src]
pub fn around<M: Into<MessageId>>(self, message_id: M) -> Self
Indicates to retrieve the messages around a specific message in either direction (before+after) the given message.
pub fn before<M: Into<MessageId>>(self, message_id: M) -> Self
[src]
pub fn before<M: Into<MessageId>>(self, message_id: M) -> Self
Indicates to retrieve the messages before a specific message, given by its Id.
pub fn limit(self, limit: u64) -> Self
[src]
pub fn limit(self, limit: u64) -> Self
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.
pub fn most_recent(self) -> Self
[src]
pub fn most_recent(self) -> Self
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 Clone for GetMessages
[src]
impl Clone for GetMessages
fn clone(&self) -> GetMessages
[src]
fn clone(&self) -> GetMessages
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for GetMessages
[src]
impl Debug for GetMessages
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for GetMessages
[src]
impl Default for GetMessages
fn default() -> GetMessages
[src]
fn default() -> GetMessages
Returns the "default value" for a type. Read more
Auto Trait Implementations
impl Send for GetMessages
impl Send for GetMessages
impl Sync for GetMessages
impl Sync for GetMessages