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>
impl<'a> SearchGuildMessages<'a>
Sourcepub fn attachment_extension(self, attachment_extension: &'a [&'a str]) -> Self
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.
Sourcepub fn attachment_filename(self, attachment_filename: &'a [&'a str]) -> Self
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.
Filter messages by these authors.
§Errors
Returns an error of type AuthorIdCount if the number of author IDs is
invalid.
Filter messages by author type.
This field can be negated, causing results to exclude a particular type.
Use SearchFilter::Exclude to exclude results.
Sourcepub fn channel_id(self, channel_id: &'a [Id<ChannelMarker>]) -> Self
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.
Sourcepub fn content(self, content: &'a str) -> Self
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.
Sourcepub fn embed_provider(self, embed_provider: &'a [&'a str]) -> Self
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.
Sourcepub fn embed_type(self, embed_type: &'a [SearchEmbedType]) -> Self
pub fn embed_type(self, embed_type: &'a [SearchEmbedType]) -> Self
Filter messages by embed type.
Sourcepub fn has(self, has: &'a [SearchFilter<SearchHasType>]) -> Self
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.
Sourcepub fn include_nsfw(self, include_nsfw: bool) -> Self
pub fn include_nsfw(self, include_nsfw: bool) -> Self
Whether to include results from age-restricted channels.
Discord defaults this to false.
Sourcepub fn link_hostname(self, link_hostname: &'a [&'a str]) -> Self
pub fn link_hostname(self, link_hostname: &'a [&'a str]) -> Self
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.
Sourcepub fn max_id(self, max_id: Id<MessageMarker>) -> Self
pub fn max_id(self, max_id: Id<MessageMarker>) -> Self
Get messages before this message ID.
Sourcepub fn mention_everyone(self, mention_everyone: bool) -> Self
pub fn mention_everyone(self, mention_everyone: bool) -> Self
Filter messages that do or do not mention @everyone.
Sourcepub fn mentions(self, mentions: &'a [Id<UserMarker>]) -> Self
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.
Sourcepub fn mentions_role_id(self, mentions_role_id: &'a [Id<RoleMarker>]) -> Self
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.
Sourcepub fn min_id(self, min_id: Id<MessageMarker>) -> Self
pub fn min_id(self, min_id: Id<MessageMarker>) -> Self
Get messages after this message ID.
Sourcepub fn pinned(self, pinned: bool) -> Self
pub fn pinned(self, pinned: bool) -> Self
Filter messages by whether they are or are not pinned.
Sourcepub fn replied_to_message_id(
self,
replied_to_message_id: &'a [Id<MessageMarker>],
) -> Self
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.
Sourcepub fn replied_to_user_id(
self,
replied_to_user_id: &'a [Id<UserMarker>],
) -> Self
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.
Sourcepub fn sort_by(self, sort_by: SearchSortMode) -> Self
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.
Sourcepub fn sort_order(self, sort_order: SearchSortOrder) -> Self
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.