Interface MessageSearchAction
- All Superinterfaces:
FluentRestAction<MessageSearchResponse, MessageSearchAction>, RestAction<MessageSearchResponse>
RestAction specifically designed to search messages.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumRepresents a type of message author.static enumThis is different from Message's embed type, this encompasses a wider range of embed types.static enumRepresents a type of content in a message, a message can have multiple of them at once.static enumThe order in which search results are sorted.static enumThe sorting algorithm with which search results are sorted. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum length of an attachment extensionstatic final intThe maximum amount of attachment extensionsstatic final intThe maximum length of an attachment filenamestatic final intThe maximum amount of attachment filenamesstatic final intThe maximum amount of authors this search can be limited tostatic final intThe maximum amount of channels this search can be limited tostatic final intThe maximum length of the content to search forstatic final intThe maximum length of an embed providerstatic final intThe maximum amount of embed providersstatic final intThe maximum amount of messages that can be returned at oncestatic final intThe maximum length of an embed providerstatic final intThe maximum amount of link hostnamesstatic final intThe maximum amount of messages that can be skipped at oncestatic final intThe maximum amount of messages which must be replied to in order to include the messagestatic final intThe maximum amount of users which must be replied to in order to include the messagestatic final intThe maximum amount of role mentions this search can be filtered onstatic final intThe maximum amount of words that can be skipped when matching contentstatic final intThe maximum amount of user mentions this search can be filtered on -
Method Summary
Modifier and TypeMethodDescriptiondefault MessageSearchActionattachmentExtensions(String... attachmentExtensions) Keeps messages which have attachments with an extension equal to any of the provided extensions.attachmentExtensions(Collection<String> attachmentExtensions) Keeps messages which have attachments with an extension equal to any of the provided extensions.default MessageSearchActionattachmentFilenames(String... attachmentFilenames) Keeps messages which have attachments named after any of the provided names, must include the extension.attachmentFilenames(Collection<String> attachmentFilenames) Keeps messages which have attachments named after any of the provided names, must include the extension.default MessageSearchActionauthors(long... authors) Keeps messages which are sent by any of the provided author IDs.default MessageSearchActionKeeps messages which are sent by any of the provided author IDs.authors(Collection<? extends UserSnowflake> authors) Keeps messages which are sent by any of the provided authors.default MessageSearchActionauthors(UserSnowflake... authors) Keeps messages which are sent by any of the provided authors.channels(long... channels) Keeps messages from any of the provided channels.Keeps messages from any of the provided channels.channels(Collection<? extends GuildMessageChannel> channels) Keeps messages from any of the provided channels.default MessageSearchActionchannels(GuildMessageChannel... channels) Keeps messages from any of the provided channels.Sets the content to search for.default MessageSearchActionembedProvider(String... embedProviders) Keeps messages which have embeds created from any of the provided embed providers, such asTenororGiphy, as retrievable fromMessageEmbed.Provider.getName().embedProvider(Collection<String> embedProviders) Keeps messages which have embeds created from any of the provided embed providers, such asTenororGiphy, as retrievable fromMessageEmbed.Provider.getName().embedTypes(Collection<MessageSearchAction.EmbedType> embedTypes) Keeps messages which have embeds from any of the provided embed types.default MessageSearchActionembedTypes(MessageSearchAction.EmbedType... embedTypes) Keeps messages which have embeds from any of the provided embed types.excludeAuthorTypes(Collection<MessageSearchAction.AuthorType> authorTypes) Excludes messages which are sent by any of the provided author types.default MessageSearchActionexcludeAuthorTypes(MessageSearchAction.AuthorType... authorTypes) Excludes messages which are sent by any of the provided author types.excludeHasTypes(Collection<MessageSearchAction.HasType> hasTypes) Excludes messages which include content matching any of the provided content types.default MessageSearchActionexcludeHasTypes(MessageSearchAction.HasType... hasTypes) Excludes messages which include content matching any of the provided content types.includeAuthorTypes(Collection<MessageSearchAction.AuthorType> authorTypes) Includes messages which are sent by any of the provided author types.default MessageSearchActionincludeAuthorTypes(MessageSearchAction.AuthorType... authorTypes) Includes messages which are sent by any of the provided author types.includeHasTypes(Collection<MessageSearchAction.HasType> hasTypes) Includes messages which include content matching any of the provided content types.default MessageSearchActionincludeHasTypes(MessageSearchAction.HasType... hasTypes) Includes messages which include content matching any of the provided content types.includeNsfw(boolean includeNsfw) Whether to include results from age-restricted channels.Sets the maximum number of messages to return.default MessageSearchActionlinkHostnames(String... linkHostnames) Keeps messages which have links from any of the provided hostnames, such asmedia.discordapp.comorjda.wiki.linkHostnames(Collection<String> linkHostnames) Keeps messages which have links from any of the provided hostnames, such asmedia.discordapp.comorjda.wiki.maxId(long maxId) Sets the ID of the message to end the search at.Sets the ID of the message to end the search at.mentionsEveryone(Boolean mentionsEveryone) Filters messages by whether they are or are not mentioning @everyone.mentionsRoles(Collection<? extends Role> mentions) Keeps messages which mention any of the provided roles.default MessageSearchActionmentionsRoles(Role... mentions) Keeps messages which mention any of the provided roles.default MessageSearchActionmentionsUsers(long... mentions) Keeps messages which mention any of the provided users.default MessageSearchActionmentionsUsers(String... mentions) Keeps messages which mention any of the provided users.mentionsUsers(Collection<? extends UserSnowflake> mentions) Keeps messages which mention any of the provided users.default MessageSearchActionmentionsUsers(UserSnowflake... mentions) Keeps messages which mention any of the provided users.minId(long minId) Sets the ID of the message to start searching from.Sets the ID of the message to start searching from.Sets the offset of the returned messages.Filters messages by whether they are or are not pinned.default MessageSearchActionrepliesToMessages(long... repliedTo) Keeps messages which replies to any of the provided message IDs.default MessageSearchActionrepliesToMessages(String... repliedTo) Keeps messages which replies to any of the provided message IDs.repliesToMessages(Collection<String> repliedTo) Keeps messages which replies to any of the provided message IDs.default MessageSearchActionrepliesToUsers(long... repliedTo) Keeps messages which replies to any of the provided user IDs.default MessageSearchActionrepliesToUsers(String... repliedTo) Keeps messages which replies to any of the provided user IDs.repliesToUsers(Collection<? extends UserSnowflake> repliedTo) Keeps messages which replies to any of the provided users.default MessageSearchActionrepliesToUsers(UserSnowflake... repliedTo) Keeps messages which replies to any of the provided users.Sets the maximum number of words to skip between matching tokens in the search content.sortBy(MessageSearchAction.SortType sortType) Sorts messages by the provided sorting algorithm.sortOrder(MessageSearchAction.SortOrder sortOrder) Sorts messages by the provided sort order.Methods inherited from interface FluentRestAction
addCheck, deadline, setCheck, timeoutMethods inherited from interface RestAction
and, and, complete, complete, completeAfter, delay, delay, delay, delay, flatMap, flatMap, getCheck, getJDA, map, mapToResult, onErrorFlatMap, onErrorFlatMap, onErrorMap, onErrorMap, onSuccess, queue, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, submit, submit, submitAfter, submitAfter, zip
-
Field Details
-
MAX_OFFSET
static final int MAX_OFFSETThe maximum amount of messages that can be skipped at once- See Also:
-
MAX_LIMIT
static final int MAX_LIMITThe maximum amount of messages that can be returned at once- See Also:
-
MAX_SLOP
static final int MAX_SLOPThe maximum amount of words that can be skipped when matching content- See Also:
-
MAX_CONTENT_LENGTH
static final int MAX_CONTENT_LENGTHThe maximum length of the content to search for- See Also:
-
MAX_CHANNELS
static final int MAX_CHANNELSThe maximum amount of channels this search can be limited to- See Also:
-
MAX_AUTHORS
static final int MAX_AUTHORSThe maximum amount of authors this search can be limited to- See Also:
-
MAX_USER_MENTIONS
static final int MAX_USER_MENTIONSThe maximum amount of user mentions this search can be filtered on- See Also:
-
MAX_ROLE_MENTIONS
static final int MAX_ROLE_MENTIONSThe maximum amount of role mentions this search can be filtered on- See Also:
-
MAX_REPLIED_TO_USERS
static final int MAX_REPLIED_TO_USERSThe maximum amount of users which must be replied to in order to include the message- See Also:
-
MAX_REPLIED_TO_MESSAGES
static final int MAX_REPLIED_TO_MESSAGESThe maximum amount of messages which must be replied to in order to include the message- See Also:
-
MAX_EMBED_PROVIDERS
static final int MAX_EMBED_PROVIDERSThe maximum amount of embed providers- See Also:
-
MAX_EMBED_PROVIDER_LENGTH
static final int MAX_EMBED_PROVIDER_LENGTHThe maximum length of an embed provider- See Also:
-
MAX_LINK_HOSTNAMES
static final int MAX_LINK_HOSTNAMESThe maximum amount of link hostnames- See Also:
-
MAX_LINK_HOSTNAME_LENGTH
static final int MAX_LINK_HOSTNAME_LENGTHThe maximum length of an embed provider- See Also:
-
MAX_ATTACHMENT_FILENAMES
static final int MAX_ATTACHMENT_FILENAMESThe maximum amount of attachment filenames- See Also:
-
MAX_ATTACHMENT_FILENAME_LENGTH
static final int MAX_ATTACHMENT_FILENAME_LENGTHThe maximum length of an attachment filename- See Also:
-
MAX_ATTACHMENT_EXTENSIONS
static final int MAX_ATTACHMENT_EXTENSIONSThe maximum amount of attachment extensions- See Also:
-
MAX_ATTACHMENT_EXTENSION_LENGTH
static final int MAX_ATTACHMENT_EXTENSION_LENGTHThe maximum length of an attachment extension- See Also:
-
-
Method Details
-
limit
@Nonnull @CheckReturnValue MessageSearchAction limit(@Nullable @Range(from=1L,to=25L) Integer limit) Sets the maximum number of messages to return.Note: The search may return fewer results when messages have not been accessed for a long time, as such, you should not rely on the length of the messages list to paginate results. Use
minId(long)and/ormaxId(long)instead.- Parameters:
limit- Max number of messages to return, between 1 and 25, ornullto use the default (25)- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the provided limit is not between 1 and 25 and notnull
-
offset
@Nonnull @CheckReturnValue MessageSearchAction offset(@Nullable @Range(from=1L,to=9975L) Integer offset) Sets the offset of the returned messages.Note: You must not offset the search by the number of messages received from a previous request, to implement some pagination, you should instead specify
minId(long)ormaxId(long), depending on the desired direction.- Parameters:
offset- Offset of messages, between 1 and 9975, ornullto remove the offset- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the provided offset is not between 1 and 9975 and notnull
-
minId
Sets the ID of the message to start searching from. In other words, the results will only include messages newer than the specified ID.This doesn't need to be a real message's ID, this filter is based on the timestamp encoded in the snowflake, meaning you can use this method to limit messages to a certain time period.
Tip: If you want to include the message in the results, you can decrement the ID.
- Parameters:
minId- The minimum message ID to search from (excluded)- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the provided ID is negative
-
minId
Sets the ID of the message to start searching from. In other words, the results will only include messages newer than the specified ID.This doesn't need to be a real message's ID, this filter is based on the timestamp encoded in the snowflake, meaning you can use this method to limit messages to a certain time period.
Tip: If you want to include the message in the results, you can decrement the ID.
- Parameters:
minId- The minimum message ID to search from (excluded), ornullto remove the min ID- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the provided ID is notnulland is not a valid snowflake
-
maxId
Sets the ID of the message to end the search at. In other words, the results will only include messages older than the specified ID.This doesn't need to be a real message's ID, this filter is based on the timestamp encoded in the snowflake, meaning you can use this method to limit messages to a certain time period.
Tip: If you want to include the message in the results, you can increment the ID.
- Parameters:
maxId- The message ID to stop at (excluded)- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the provided ID is negative
-
maxId
Sets the ID of the message to end the search at. In other words, the results will only include messages older than the specified ID.This doesn't need to be a real message's ID, this filter is based on the timestamp encoded in the snowflake, meaning you can use this method to limit messages to a certain time period.
Tip: If you want to include the message in the results, you can increment the ID.
- Parameters:
maxId- The message ID to stop at (excluded), ornullto remove the max ID- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the provided ID is notnulland is not a valid snowflake
-
slop
Sets the maximum number of words to skip between matching tokens in the search content.- Parameters:
slop- Maximum numbers of words to skip when matching content, up to 100, ornullto set to the default (2)- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the provided value is not between 0 and 100 and notnull
-
content
Sets the content to search for.- Parameters:
content- The content to search for, up to 1024 characters, ornullto remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the content is longer than 1024 characters and notnull- See Also:
-
channels
@Nonnull @CheckReturnValue MessageSearchAction channels(@Nonnull Collection<? extends GuildMessageChannel> channels) Keeps messages from any of the provided channels. Threads, archived or not, can also be passed.Note: This implicitly includes child threads!
- Parameters:
channels- The channels to search messages in, up to 500, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection or one of its element isnull, or the collection has more than 500 elementsMissingAccessException- If the current member does not have the access to one of the channels- For text channels, this requires
Permission.VIEW_CHANNEL - For voice channels, this requires
Permission.VIEW_CHANNELandPermission.VOICE_CONNECT
- For text channels, this requires
InsufficientPermissionException- If the current member does not have theMESSAGE_HISTORYpermission in one of the channels
-
channels
@Nonnull @CheckReturnValue default MessageSearchAction channels(@Nonnull GuildMessageChannel... channels) Keeps messages from any of the provided channels. Threads, archived or not, can also be passed.Note: This implicitly includes child threads!
- Parameters:
channels- The channels to search messages in, up to 500, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array or an element isnull, or the array has more than 500 elementsMissingAccessException- If the current member does not have the access to one of the channels- For text channels, this requires
Permission.VIEW_CHANNEL - For voice channels, this requires
Permission.VIEW_CHANNELandPermission.VOICE_CONNECT
- For text channels, this requires
InsufficientPermissionException- If the current member does not have theMESSAGE_HISTORYpermission in one of the channels
-
channels
Keeps messages from any of the provided channels. Threads, archived or not, can also be passed.Note: This implicitly includes child threads!
- Parameters:
channels- The channels to search messages in, up to 500, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array isnull, or has more than 500 elements
-
channels
Keeps messages from any of the provided channels. Threads, archived or not, can also be passed.Note: This implicitly includes child threads!
- Parameters:
channels- The channels to search messages in, up to 500, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array or an element isnull, an element isn't a valid snowflake, or the array has more than 500 elements
-
includeAuthorTypes
@Nonnull @CheckReturnValue MessageSearchAction includeAuthorTypes(@Nonnull Collection<MessageSearchAction.AuthorType> authorTypes) - Parameters:
authorTypes- The type of authors to keep, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection or an element isnull
-
includeAuthorTypes
@Nonnull @CheckReturnValue default MessageSearchAction includeAuthorTypes(@Nonnull MessageSearchAction.AuthorType... authorTypes) Includes messages which are sent by any of the provided author types.
This overrides exclusions!- Parameters:
authorTypes- The type of authors to keep, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array or an element isnull
-
excludeAuthorTypes
@Nonnull @CheckReturnValue MessageSearchAction excludeAuthorTypes(@Nonnull Collection<MessageSearchAction.AuthorType> authorTypes) Excludes messages which are sent by any of the provided author types.
This overrides inclusions!- Parameters:
authorTypes- The type of authors to avoid, leave empty to remove the exclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection or an element isnull
-
excludeAuthorTypes
@Nonnull @CheckReturnValue default MessageSearchAction excludeAuthorTypes(@Nonnull MessageSearchAction.AuthorType... authorTypes) Excludes messages which are sent by any of the provided author types.
This overrides inclusions!- Parameters:
authorTypes- The type of authors to avoid, leave empty to remove the exclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array or an element isnull
-
authors
@Nonnull @CheckReturnValue MessageSearchAction authors(@Nonnull Collection<? extends UserSnowflake> authors) Keeps messages which are sent by any of the provided authors.- Parameters:
authors- The authors to keep messages from, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection or an element isnull, or the collection has more than 100 elements
-
authors
Keeps messages which are sent by any of the provided authors.- Parameters:
authors- The authors to keep messages from, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array or an element isnull, or the array has more than 100 elements
-
authors
Keeps messages which are sent by any of the provided author IDs.- Parameters:
authors- The author IDs to keep messages from, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array or an element isnull, or one of the author IDs is not a valid snowflake, or the array has more than 100 elements
-
authors
Keeps messages which are sent by any of the provided author IDs.- Parameters:
authors- The author IDs to keep messages from, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array isnull, or the array has more than 100 elements
-
mentionsUsers
@Nonnull @CheckReturnValue MessageSearchAction mentionsUsers(@Nonnull Collection<? extends UserSnowflake> mentions) Keeps messages which mention any of the provided users.A "mention" here includes anything that makes a "ping" (highlighted for user):
Mentions which have been disabled and not allowlisted, will not match.
- Parameters:
mentions- The users which must be mentioned in the messages, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection is, or containsnull, or the collection has more than 100 elements
-
mentionsUsers
@Nonnull @CheckReturnValue default MessageSearchAction mentionsUsers(@Nonnull UserSnowflake... mentions) Keeps messages which mention any of the provided users.A "mention" here includes anything that makes a "ping" (creates a special background on the client):
Mentions which have been disabled and not allowlisted, will not match.
- Parameters:
mentions- The users which must be mentioned in the messages, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array is, or containsnull, or the array has more than 100 elements
-
mentionsUsers
Keeps messages which mention any of the provided users.A "mention" here includes anything that makes a "ping" (creates a special background on the client):
Mentions which have been disabled and not allowlisted, will not match.
- Parameters:
mentions- The IDs of the users which must be mentioned in the messages, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array is, or containsnull, or is not a valid snowflake, or the array has more than 100 elements
-
mentionsUsers
Keeps messages which mention any of the provided users.A "mention" here includes anything that makes a "ping" (creates a special background on the client):
Mentions which have been disabled and not allowlisted, will not match.
- Parameters:
mentions- The IDs of the users which must be mentioned in the messages, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array isnull, or the array has more than 100 elements
-
mentionsRoles
@Nonnull @CheckReturnValue MessageSearchAction mentionsRoles(@Nonnull Collection<? extends Role> mentions) Keeps messages which mention any of the provided roles.Mentions which have been disabled and not allowlisted, will not match.
Note: If the
@everyonerole is included, it will only match those that were created from the mention, but not when the raw content is "@everyone", usementionsEveryone(Boolean)for those instead.- Parameters:
mentions- The roles which must be mentioned in the messages, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection is, or containsnull, or the collection has more than 100 elements
-
mentionsRoles
Keeps messages which mention any of the provided roles.Mentions which have been disabled and not allowlisted, will not match.
Note: If the
@everyonerole is included, it will only match those that were created from the mention, but not when the raw content is "@everyone", usementionsEveryone(Boolean)for those instead.- Parameters:
mentions- The roles which must be mentioned in the messages, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array is, or containsnull, or the array has more than 100 elements
-
mentionsEveryone
Filters messages by whether they are or are not mentioning @everyone.
When set totrue, this will keep messages that mention everyone, whenfalse, this will exclude them.Mentions which have been disabled, or done by a user missing
Permission.MESSAGE_MENTION_EVERYONE, will not match.Note: This will only match message which raw content is "@everyone", mentions of the `@everyone` role will not match, use
mentionsRoles(Role...)for those instead.- Parameters:
mentionsEveryone-trueto search messages mentioning everyone,falseto exclude them,nullto keep both- Returns:
- This action for chaining
-
repliesToUsers
@Nonnull @CheckReturnValue MessageSearchAction repliesToUsers(@Nonnull Collection<? extends UserSnowflake> repliedTo) Keeps messages which replies to any of the provided users.- Parameters:
repliedTo- The users which must be replied to, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection is, or containsnull, or the collection has more than 100 elements
-
repliesToUsers
@Nonnull @CheckReturnValue default MessageSearchAction repliesToUsers(@Nonnull UserSnowflake... repliedTo) Keeps messages which replies to any of the provided users.- Parameters:
repliedTo- The users which must be replied to, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array is, or containsnull, or the array has more than 100 elements
-
repliesToUsers
Keeps messages which replies to any of the provided user IDs.- Parameters:
repliedTo- The user IDs which must be replied to, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array is, or containsnull, or is not a valid snowflake, or the array has more than 100 elements
-
repliesToUsers
Keeps messages which replies to any of the provided user IDs.- Parameters:
repliedTo- The user IDs which must be replied to, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array isnull, or the array has more than 100 elements
-
repliesToMessages
@Nonnull @CheckReturnValue MessageSearchAction repliesToMessages(@Nonnull Collection<String> repliedTo) Keeps messages which replies to any of the provided message IDs.- Parameters:
repliedTo- The message IDs which must be replied to, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection is, or containsnull, or the collection has more than 100 elements
-
repliesToMessages
@Nonnull @CheckReturnValue default MessageSearchAction repliesToMessages(@Nonnull long... repliedTo) Keeps messages which replies to any of the provided message IDs.- Parameters:
repliedTo- The message IDs which must be replied to, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array isnull, or the array has more than 100 elements
-
repliesToMessages
@Nonnull @CheckReturnValue default MessageSearchAction repliesToMessages(@Nonnull String... repliedTo) Keeps messages which replies to any of the provided message IDs.- Parameters:
repliedTo- The message IDs which must be replied to, up to 100, leave empty to remove the filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array is, or containsnull, or is not a valid snowflake, or the array has more than 100 elements
-
pinned
Filters messages by whether they are or are not pinned.
When set totrue, this will keep messages that are pinned, whenfalse, this will exclude them.- Parameters:
pinned-trueto search pinned messages,falseto exclude them,nullto keep both- Returns:
- This action for chaining
-
includeHasTypes
@Nonnull @CheckReturnValue MessageSearchAction includeHasTypes(@Nonnull Collection<MessageSearchAction.HasType> hasTypes) Includes messages which include content matching any of the provided content types.
This overrides exclusions!- Parameters:
hasTypes- The content types to keep, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection or an element isnull
-
includeHasTypes
@Nonnull @CheckReturnValue default MessageSearchAction includeHasTypes(@Nonnull MessageSearchAction.HasType... hasTypes) Includes messages which include content matching any of the provided content types.
This overrides exclusions!- Parameters:
hasTypes- The content types to keep, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array or an element isnull
-
excludeHasTypes
@Nonnull @CheckReturnValue MessageSearchAction excludeHasTypes(@Nonnull Collection<MessageSearchAction.HasType> hasTypes) Excludes messages which include content matching any of the provided content types.
This overrides inclusions!- Parameters:
hasTypes- The content types to exclude, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection or an element isnull
-
excludeHasTypes
@Nonnull @CheckReturnValue default MessageSearchAction excludeHasTypes(@Nonnull MessageSearchAction.HasType... hasTypes) Excludes messages which include content matching any of the provided content types.
This overrides inclusions!- Parameters:
hasTypes- The content types to exclude, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array or an element isnull
-
embedTypes
@Nonnull @CheckReturnValue MessageSearchAction embedTypes(@Nonnull Collection<MessageSearchAction.EmbedType> embedTypes) Keeps messages which have embeds from any of the provided embed types.- Parameters:
embedTypes- The embed types, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the collection or an element isnull
-
embedTypes
@Nonnull @CheckReturnValue default MessageSearchAction embedTypes(@Nonnull MessageSearchAction.EmbedType... embedTypes) Keeps messages which have embeds from any of the provided embed types.- Parameters:
embedTypes- The embed types, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the array or an element isnull
-
embedProvider
@Nonnull @CheckReturnValue MessageSearchAction embedProvider(@Nonnull Collection<String> embedProviders) Keeps messages which have embeds created from any of the provided embed providers, such asTenororGiphy, as retrievable fromMessageEmbed.Provider.getName().- Parameters:
embedProviders- The embed provider names, case-sensitive, max 256 characters per provider, up to 100, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException-
-
embedProvider
@Nonnull @CheckReturnValue default MessageSearchAction embedProvider(@Nonnull String... embedProviders) Keeps messages which have embeds created from any of the provided embed providers, such asTenororGiphy, as retrievable fromMessageEmbed.Provider.getName().- Parameters:
embedProviders- The embed provider names, case-sensitive, max 256 characters per provider, up to 100, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException-
-
linkHostnames
@Nonnull @CheckReturnValue MessageSearchAction linkHostnames(@Nonnull Collection<String> linkHostnames) Keeps messages which have links from any of the provided hostnames, such asmedia.discordapp.comorjda.wiki.- Parameters:
linkHostnames- The link hostnames, max 256 characters per hostname, up to 100, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException-
-
linkHostnames
@Nonnull @CheckReturnValue default MessageSearchAction linkHostnames(@Nonnull String... linkHostnames) Keeps messages which have links from any of the provided hostnames, such asmedia.discordapp.comorjda.wiki.- Parameters:
linkHostnames- The link hostnames, max 256 characters per hostname, up to 100, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException-
-
attachmentFilenames
@Nonnull @CheckReturnValue MessageSearchAction attachmentFilenames(@Nonnull Collection<String> attachmentFilenames) Keeps messages which have attachments named after any of the provided names, must include the extension.- Parameters:
attachmentFilenames- The attachment file names, max 256 characters per file name, up to 100, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException-
-
attachmentFilenames
@Nonnull @CheckReturnValue default MessageSearchAction attachmentFilenames(@Nonnull String... attachmentFilenames) Keeps messages which have attachments named after any of the provided names, must include the extension.- Parameters:
attachmentFilenames- The attachment file names, max 256 characters per file name, up to 100, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException-
-
attachmentExtensions
@Nonnull @CheckReturnValue MessageSearchAction attachmentExtensions(@Nonnull Collection<String> attachmentExtensions) Keeps messages which have attachments with an extension equal to any of the provided extensions.- Parameters:
attachmentExtensions- The attachment extensions, max 256 characters per extension, up to 100, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException-
-
attachmentExtensions
@Nonnull @CheckReturnValue default MessageSearchAction attachmentExtensions(@Nonnull String... attachmentExtensions) Keeps messages which have attachments with an extension equal to any of the provided extensions.- Parameters:
attachmentExtensions- The attachment extensions, max 256 characters per extension, up to 100, leave empty to remove the inclusion filter- Returns:
- This action for chaining
- Throws:
IllegalArgumentException-
-
sortBy
@Nonnull @CheckReturnValue MessageSearchAction sortBy(@Nonnull MessageSearchAction.SortType sortType) Sorts messages by the provided sorting algorithm.
The default isTIMESTAMP.- Parameters:
sortType- The sorting algorithm to use- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the argument isnull
-
sortOrder
@Nonnull @CheckReturnValue MessageSearchAction sortOrder(@Nonnull MessageSearchAction.SortOrder sortOrder) Sorts messages by the provided sort order. This is only relevant whenSortType.TIMESTAMPis used (the default).
The default isDESC.- Parameters:
sortOrder- The sort order to use- Returns:
- This action for chaining
- Throws:
IllegalArgumentException- If the argument isnull
-
includeNsfw
Whether to include results from age-restricted channels.
Default:false- Parameters:
includeNsfw-trueto include age-restricted channels- Returns:
- This action for chaining
-