Skip to main content

SearchGuildMessages

Struct SearchGuildMessages 

Source
#[non_exhaustive]
pub struct SearchGuildMessages {
Show 24 fields pub limit: Option<u8>, pub offset: Option<u16>, pub max_id: Option<MessageId>, pub min_id: Option<MessageId>, pub slop: Option<u8>, pub content: Option<CompactString>, pub channel_id: Vec<ChannelId>, pub author_type: Vec<SearchFilter<SearchAuthorType>>, pub author_id: Vec<UserId>, pub mentions: Vec<UserId>, pub mentions_role_id: Vec<RoleId>, pub mention_everyone: Option<bool>, pub replied_to_user_id: Vec<UserId>, pub replied_to_message_id: Vec<MessageId>, pub pinned: Option<bool>, pub has: Vec<SearchFilter<SearchHasType>>, pub embed_type: Vec<SearchEmbedType>, pub embed_provider: Vec<CompactString>, pub link_hostname: Vec<CompactString>, pub attachment_filename: Vec<CompactString>, pub attachment_extension: Vec<CompactString>, pub sort_by: Option<SearchSortMode>, pub sort_order: Option<SearchSortOrder>, pub include_nsfw: Option<bool>,
}
Expand description

The query of Search Guild Messages (GET /guilds/{guild.id}/messages/search). Every filter is optional; list filters match any of their values.

The endpoint needs READ_MESSAGE_HISTORY and depends on the MESSAGE_CONTENT privileged intent. While the guild is not indexed yet, the request fails with ErrorKind::NotYetIndexed of djs-rest (D-104).

discord.js counterpart: RESTGetAPIGuildMessagesSearchQuery (discord-api-types).

§Examples

use djs_model::rest::{SearchFilter, SearchGuildMessages, SearchHasType};

let mut query = SearchGuildMessages::default();
query.content = Some("release".into());
query.has = vec![SearchFilter::Include(SearchHasType::Link)];
query.author_type = vec![SearchFilter::Exclude(djs_model::rest::SearchAuthorType::Bot)];

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§limit: Option<u8>

How many messages (1-25; Discord’s default is 25).

§offset: Option<u16>

How many results to skip (max 9975).

§max_id: Option<MessageId>

Messages before this message.

§min_id: Option<MessageId>

Messages after this message.

§slop: Option<u8>

How many words may lie between the matching words of content (max 100; default 2).

§content: Option<CompactString>

Text the messages contain (max 1024 characters).

§channel_id: Vec<ChannelId>

Messages in these channels (max 500).

§author_type: Vec<SearchFilter<SearchAuthorType>>

Messages by these kinds of authors (or not, with SearchFilter::Exclude).

§author_id: Vec<UserId>

Messages by these users (max 100).

§mentions: Vec<UserId>

Messages mentioning these users (max 100).

§mentions_role_id: Vec<RoleId>

Messages mentioning these roles (max 100).

§mention_everyone: Option<bool>

Messages that do (or do not) mention @everyone.

§replied_to_user_id: Vec<UserId>

Messages replying to these users (max 100).

§replied_to_message_id: Vec<MessageId>

Messages replying to these messages (max 100).

§pinned: Option<bool>

Messages that are (or are not) pinned.

§has: Vec<SearchFilter<SearchHasType>>

Messages that have (or do not have) these things.

§embed_type: Vec<SearchEmbedType>

Messages with these kinds of embeds.

§embed_provider: Vec<CompactString>

Messages with embeds from these providers, case-sensitive (e.g. Tenor; max 100).

§link_hostname: Vec<CompactString>

Messages with links to these host names (e.g. discordapp.com; max 100).

§attachment_filename: Vec<CompactString>

Messages with attachments of these file names (max 100).

§attachment_extension: Vec<CompactString>

Messages with attachments of these extensions (e.g. txt; max 100).

§sort_by: Option<SearchSortMode>

How to sort (Discord’s default: by time).

§sort_order: Option<SearchSortOrder>

The direction (Discord’s default: descending); ignored when sorting by relevance.

§include_nsfw: Option<bool>

Whether to include age-restricted channels (Discord’s default: no).

Trait Implementations§

Source§

impl Clone for SearchGuildMessages

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SearchGuildMessages

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SearchGuildMessages

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for SearchGuildMessages

Source§

impl PartialEq for SearchGuildMessages

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SearchGuildMessages

Auto Trait Implementations§

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.