Skip to main content

SearchGuildMessages

Struct SearchGuildMessages 

Source
pub struct SearchGuildMessages<'a> { /* private fields */ }
Expand description

Search a guild’s messages.

Returned messages do not have the reactions field.

Refer to the module-level documentation for more information about message indexing and pagination, as well as for examples.

Requires the READ_MESSAGE_HISTORY permission. This endpoint is restricted according to whether the MESSAGE_CONTENT Privileged Intent is enabled for your application.

Implementations§

Source§

impl<'a> SearchGuildMessages<'a>

Source

pub fn attachment_extension(self, attachment_extension: &'a [&'a str]) -> Self

Filter messages by attachment extension (e.g. txt).

§Errors

Returns an error of type AttachmentExtensionCount if the number of attachment extension entries is invalid.

Returns an error of type AttachmentExtensionEntryLength if one of the attachment extension entries has an invalid length.

Source

pub fn attachment_filename(self, attachment_filename: &'a [&'a str]) -> Self

Filter messages by attachment filename.

§Errors

Returns an error of type AttachmentFilenameCount if the number of attachment filename entries is invalid.

Returns an error of type AttachmentFilenameEntryLength if one of the attachment filename entries has an invalid length.

Source

pub fn author_id(self, author_id: &'a [Id<UserMarker>]) -> Self

Filter messages by these authors.

§Errors

Returns an error of type AuthorIdCount if the number of author IDs is invalid.

Source

pub fn author_type(self, author_type: &'a [SearchFilter<AuthorType>]) -> Self

Filter messages by author type.

This field can be negated, causing results to exclude a particular type. Use SearchFilter::Exclude to exclude results.

Source

pub fn channel_id(self, channel_id: &'a [Id<ChannelMarker>]) -> Self

Filter messages by these channels.

§Errors

Returns an error of type ChannelIdCount if the number of channel IDs is invalid.

Source

pub fn content(self, content: &'a str) -> Self

Filter messages by content.

§Errors

Returns an error of type ContentLength is the content is too long.

Source

pub fn embed_provider(self, embed_provider: &'a [&'a str]) -> Self

Filter messages by embed provider (case-sensitive, e.g. Tenor).

§Errors

Returns an error of type EmbedProviderCount if the number of embed provider entries is invalid.

Returns an error of type EmbedProviderEntryLength if one of the embed provider entries has an invalid length.

Source

pub fn embed_type(self, embed_type: &'a [SearchEmbedType]) -> Self

Filter messages by embed type.

Source

pub fn has(self, has: &'a [SearchFilter<SearchHasType>]) -> Self

Filter messages by whether or not they have specific things.

This field can be negated, causing results to exclude a particular type. Use SearchFilter::Exclude to exclude results.

Source

pub fn include_nsfw(self, include_nsfw: bool) -> Self

Whether to include results from age-restricted channels.

Discord defaults this to false.

Source

pub fn limit(self, limit: u8) -> Self

Max number of messages to return.

Discord defaults this to 25.

§Errors

Returns an error of type Limit if the limit is invalid.

Filter messages by link hostname (e.g. discordapp.com).

§Errors

Returns an error of type LinkHostnameCount if the number of link hostname entries is invalid.

Returns an error of type LinkHostnameEntryLength if one of the link hostname entries has an invalid length.

Source

pub fn max_id(self, max_id: Id<MessageMarker>) -> Self

Get messages before this message ID.

Source

pub fn mention_everyone(self, mention_everyone: bool) -> Self

Filter messages that do or do not mention @everyone.

Source

pub fn mentions(self, mentions: &'a [Id<UserMarker>]) -> Self

Filter messages that mention these users.

§Errors

Returns an error of type MentionsCount if the number of mentions is invalid.

Source

pub fn mentions_role_id(self, mentions_role_id: &'a [Id<RoleMarker>]) -> Self

Filter messages that mention these roles.

§Errors

Returns an error of type MentionsRoleIdCount if the number of mention roles is invalid.

Source

pub fn min_id(self, min_id: Id<MessageMarker>) -> Self

Get messages after this message ID.

Source

pub fn offset(self, offset: u16) -> Self

Number to offset the returned messages by.

§Errors

Returns an error of type Offset if the offset is invalid.

Source

pub fn pinned(self, pinned: bool) -> Self

Filter messages by whether they are or are not pinned.

Source

pub fn replied_to_message_id( self, replied_to_message_id: &'a [Id<MessageMarker>], ) -> Self

Filter messages that reply to these messages.

§Errors

Returns an error of type RepliedToMessageIdCount if the number of replied to message IDs is invalid.

Source

pub fn replied_to_user_id( self, replied_to_user_id: &'a [Id<UserMarker>], ) -> Self

Filter messages that reply to these users.

§Errors

Returns an error of type RepliedToUserIdCount if the number of replied to user IDs is invalid.

Source

pub fn slop(self, slop: u16) -> Self

Max number of words to skip between matching tokens in the search content.

Discord defaults this to 2.

§Errors

Returns an error of type Slop if the slop is invalid.

Source

pub fn sort_by(self, sort_by: SearchSortMode) -> Self

The sorting algorithm to use.

When the sort mode is set to SearchSortMode::Relevance Discord will not respect the sort order set via sort_order.

Discord defaults this to SearchSortMode::Timestamp.

Source

pub fn sort_order(self, sort_order: SearchSortOrder) -> Self

The direction to sort.

Discord will not respect the sort order when the sort mode is SearchSortMode::Relevance via sort_by.

Discord defaults this to SearchSortOrder::Descending.

Trait Implementations§

Source§

impl IntoFuture for SearchGuildMessages<'_>

Source§

type Output = Result<Response<SearchGuildMessagesResponseBody>, Error>

The output that the future will produce on completion.
Source§

type IntoFuture = ResponseFuture<SearchGuildMessagesResponseBody>

Which kind of future are we turning this into?
Source§

fn into_future(self) -> Self::IntoFuture

Creates a future from a value. Read more
Source§

impl TryIntoRequest for SearchGuildMessages<'_>

Source§

fn try_into_request(self) -> Result<Request, Error>

Try to convert a request builder into a raw Request. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for SearchGuildMessages<'a>

§

impl<'a> !UnwindSafe for SearchGuildMessages<'a>

§

impl<'a> Forget for SearchGuildMessages<'a>

§

impl<'a> Freeze for SearchGuildMessages<'a>

§

impl<'a> Move for SearchGuildMessages<'a>

§

impl<'a> Send for SearchGuildMessages<'a>
where &'a [&'a str]: Send, &'a [Id<UserMarker>]: Send, &'a [SearchFilter<AuthorType>]: Send, &'a [Id<ChannelMarker>]: Send, &'a str: Send, &'a [SearchEmbedType]: Send, &'a [SearchFilter<SearchHasType>]: Send, NonZero<u64>: Send, &'a [Id<RoleMarker>]: Send, &'a [Id<MessageMarker>]: Send, &'a Client: Send,

§

impl<'a> Sync for SearchGuildMessages<'a>
where NonZero<u64>: Sync, RawVecInner: Sync, BoxRaw<[Pos]>: Sync, Bytes: Sync, Arc<Config>: Sync, Arc<Resolver<GenericConnector<TokioRuntimeProvider>>>: Sync, Arc<ClientConfig>: Sync, Arc<dyn ResolveServerName + Send + Sync>: Sync, Arc<dyn Executor<Pin<Box<dyn Future<Output = ()> + Send>>> + Send + Sync>: Sync, Arc<dyn Timer + Send + Sync>: Sync, Arc<Mutex<PoolInner<PoolClient<Full<Bytes>>, (Scheme, Authority)>>>: Sync, BoxRaw<str>: Sync, Arc<Chan<(Message, Option<Box<dyn FnOnce(Option<Bucket>) -> bool + Send>>), Semaphore>>: Sync, Arc<Atomic<bool>>: Sync,

§

impl<'a> Unpin for SearchGuildMessages<'a>

§

impl<'a> UnsafeUnpin for SearchGuildMessages<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

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

fn in_current_span(self) -> Instrumented<Self> ⓘ

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

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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