Struct serenity::builder::GetMessages
source · [−]builder
only.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
sourceimpl GetMessages
impl GetMessages
sourcepub fn after<M: Into<MessageId>>(&mut self, message_id: M) -> &mut Self
pub fn after<M: Into<MessageId>>(&mut self, message_id: M) -> &mut Self
Indicates to retrieve the messages after a specific message, given by its Id.
sourcepub fn around<M: Into<MessageId>>(&mut self, message_id: M) -> &mut Self
pub fn around<M: Into<MessageId>>(&mut self, message_id: M) -> &mut Self
Indicates to retrieve the messages around a specific message in either direction (before+after) the given message.
sourcepub fn before<M: Into<MessageId>>(&mut self, message_id: M) -> &mut Self
pub fn before<M: Into<MessageId>>(&mut self, message_id: M) -> &mut Self
Indicates to retrieve the messages before a specific message, given by its Id.
sourcepub fn limit(&mut self, limit: u64) -> &mut Self
pub fn limit(&mut self, limit: u64) -> &mut 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.
Trait Implementations
sourceimpl Clone for GetMessages
impl Clone for GetMessages
sourcefn clone(&self) -> GetMessages
fn clone(&self) -> GetMessages
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for GetMessages
impl Debug for GetMessages
sourceimpl Default for GetMessages
impl Default for GetMessages
sourcefn default() -> GetMessages
fn default() -> GetMessages
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for GetMessages
impl Send for GetMessages
impl Sync for GetMessages
impl Unpin for GetMessages
impl UnwindSafe for GetMessages
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more