Interface MessageSearchAction

All Superinterfaces:
FluentRestAction<MessageSearchResponse, MessageSearchAction>, RestAction<MessageSearchResponse>

public interface MessageSearchAction extends FluentRestAction<MessageSearchResponse, MessageSearchAction>
Extension of RestAction specifically designed to search messages.
See Also:
  • Field Details

    • MAX_OFFSET

      static final int MAX_OFFSET
      The maximum amount of messages that can be skipped at once
      See Also:
    • MAX_LIMIT

      static final int MAX_LIMIT
      The maximum amount of messages that can be returned at once
      See Also:
    • MAX_SLOP

      static final int MAX_SLOP
      The maximum amount of words that can be skipped when matching content
      See Also:
    • MAX_CONTENT_LENGTH

      static final int MAX_CONTENT_LENGTH
      The maximum length of the content to search for
      See Also:
    • MAX_CHANNELS

      static final int MAX_CHANNELS
      The maximum amount of channels this search can be limited to
      See Also:
    • MAX_AUTHORS

      static final int MAX_AUTHORS
      The maximum amount of authors this search can be limited to
      See Also:
    • MAX_USER_MENTIONS

      static final int MAX_USER_MENTIONS
      The maximum amount of user mentions this search can be filtered on
      See Also:
    • MAX_ROLE_MENTIONS

      static final int MAX_ROLE_MENTIONS
      The maximum amount of role mentions this search can be filtered on
      See Also:
    • MAX_REPLIED_TO_USERS

      static final int MAX_REPLIED_TO_USERS
      The 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_MESSAGES
      The 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_PROVIDERS
      The maximum amount of embed providers
      See Also:
    • MAX_EMBED_PROVIDER_LENGTH

      static final int MAX_EMBED_PROVIDER_LENGTH
      The maximum length of an embed provider
      See Also:
    • MAX_ATTACHMENT_FILENAMES

      static final int MAX_ATTACHMENT_FILENAMES
      The maximum amount of attachment filenames
      See Also:
    • MAX_ATTACHMENT_FILENAME_LENGTH

      static final int MAX_ATTACHMENT_FILENAME_LENGTH
      The maximum length of an attachment filename
      See Also:
    • MAX_ATTACHMENT_EXTENSIONS

      static final int MAX_ATTACHMENT_EXTENSIONS
      The maximum amount of attachment extensions
      See Also:
    • MAX_ATTACHMENT_EXTENSION_LENGTH

      static final int MAX_ATTACHMENT_EXTENSION_LENGTH
      The 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/or maxId(long) instead.

      Parameters:
      limit - Max number of messages to return, between 1 and 25, or null to use the default (25)
      Returns:
      This action for chaining
      Throws:
      IllegalArgumentException - If the provided limit is not between 1 and 25 and not null
    • 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) or maxId(long), depending on the desired direction.

      Parameters:
      offset - Offset of messages, between 1 and 9975, or null to remove the offset
      Returns:
      This action for chaining
      Throws:
      IllegalArgumentException - If the provided offset is not between 1 and 9975 and not null
    • minId

      @Nonnull @CheckReturnValue MessageSearchAction minId(long 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

      @Nonnull @CheckReturnValue MessageSearchAction minId(@Nullable String 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), or null to remove the min ID
      Returns:
      This action for chaining
      Throws:
      IllegalArgumentException - If the provided ID is not null and is not a valid snowflake
    • maxId

      @Nonnull @CheckReturnValue MessageSearchAction maxId(long 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

      @Nonnull @CheckReturnValue MessageSearchAction maxId(@Nullable String 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), or null to remove the max ID
      Returns:
      This action for chaining
      Throws:
      IllegalArgumentException - If the provided ID is not null and is not a valid snowflake
    • slop

      @Nonnull @CheckReturnValue MessageSearchAction slop(@Nullable @Range(from=0L,to=100L) Integer 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, or null to set to the default (2)
      Returns:
      This action for chaining
      Throws:
      IllegalArgumentException - If the provided value is not between 0 and 100 and not null
    • content

      @Nonnull @CheckReturnValue MessageSearchAction content(@Nullable String content)
      Sets the content to search for.
      Parameters:
      content - The content to search for, up to 1024 characters, or null to remove the filter
      Returns:
      This action for chaining
      Throws:
      IllegalArgumentException - If the content is longer than 1024 characters and not null
      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 is null, or the collection has more than 500 elements
      MissingAccessException - If the current member does not have the access to one of the channels
      InsufficientPermissionException - If the current member does not have the MESSAGE_HISTORY permission 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 is null, or the array has more than 500 elements
      MissingAccessException - If the current member does not have the access to one of the channels
      InsufficientPermissionException - If the current member does not have the MESSAGE_HISTORY permission in one of the channels
    • channels

      @Nonnull @CheckReturnValue MessageSearchAction channels(@Nonnull long... 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 is null, or has more than 500 elements
    • channels

      @Nonnull @CheckReturnValue MessageSearchAction channels(@Nonnull String... 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 is null, 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)
      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 collection or an element is null
    • 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 is null
    • 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 is null
    • 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 is null
    • 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 is null, or the collection has more than 100 elements
    • authors

      @Nonnull @CheckReturnValue default MessageSearchAction authors(@Nonnull 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 array or an element is null, or the array has more than 100 elements
    • authors

      @Nonnull @CheckReturnValue default MessageSearchAction authors(@Nonnull String... 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 is null, or one of the author IDs is not a valid snowflake, or the array has more than 100 elements
    • authors

      @Nonnull @CheckReturnValue default MessageSearchAction authors(@Nonnull long... 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 is null, 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 contains null, 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 contains null, or the array has more than 100 elements
    • mentionsUsers

      @Nonnull @CheckReturnValue default MessageSearchAction mentionsUsers(@Nonnull String... 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 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 contains null, or is not a valid snowflake, or the array has more than 100 elements
    • mentionsUsers

      @Nonnull @CheckReturnValue default MessageSearchAction mentionsUsers(@Nonnull long... 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 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 null, 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 @everyone role is included, it will only match those that were created from the mention, but not when the raw content is "@everyone", use mentionsEveryone(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 contains null, or the collection has more than 100 elements
    • mentionsRoles

      @Nonnull @CheckReturnValue default MessageSearchAction mentionsRoles(@Nonnull 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 @everyone role is included, it will only match those that were created from the mention, but not when the raw content is "@everyone", use mentionsEveryone(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 contains null, or the array has more than 100 elements
    • mentionsEveryone

      @Nonnull @CheckReturnValue MessageSearchAction mentionsEveryone(@Nullable Boolean mentionsEveryone)
      Filters messages by whether they are or are not mentioning @everyone.
      When set to true, this will keep messages that mention everyone, when false, 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 - true to search messages mentioning everyone, false to exclude them, null to 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 contains null, 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 contains null, or the array has more than 100 elements
    • repliesToUsers

      @Nonnull @CheckReturnValue default MessageSearchAction repliesToUsers(@Nonnull String... repliedTo)
      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 contains null, or is not a valid snowflake, or the array has more than 100 elements
    • repliesToUsers

      @Nonnull @CheckReturnValue default MessageSearchAction repliesToUsers(@Nonnull long... repliedTo)
      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 null, 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 contains null, 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 is null, 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 contains null, or is not a valid snowflake, or the array has more than 100 elements
    • pinned

      @Nonnull @CheckReturnValue MessageSearchAction pinned(@Nullable Boolean pinned)
      Filters messages by whether they are or are not pinned.
      When set to true, this will keep messages that are pinned, when false, this will exclude them.
      Parameters:
      pinned - true to search pinned messages, false to exclude them, null to 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 is null
    • 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 is null
    • 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 is null
    • 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 is null
    • 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 is null
    • 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 is null
    • embedProvider

      @Nonnull @CheckReturnValue MessageSearchAction embedProvider(@Nonnull Collection<String> embedProviders)
      Keeps messages which have embeds created from any of the provided embed providers, such as Tenor or Giphy, as retrievable from MessageEmbed.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 -
      • If the collection or an element is null
      • If a provider is larger than 256 characters
      • If there is more than 100 providers
    • embedProvider

      @Nonnull @CheckReturnValue default MessageSearchAction embedProvider(@Nonnull String... embedProviders)
      Keeps messages which have embeds created from any of the provided embed providers, such as Tenor or Giphy, as retrievable from MessageEmbed.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 -
      • If the array or an element is null
      • If a provider is larger than 256 characters
      • If there is more than 100 providers
    • linkHostnames

      @Nonnull @CheckReturnValue MessageSearchAction linkHostnames(@Nonnull Collection<String> linkHostnames)
      Keeps messages which have links from any of the provided hostnames, such as media.discordapp.com or jda.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 -
      • If the collection or an element is null
      • If a hostname is larger than 256 characters
      • If there is more than 100 hostnames
    • linkHostnames

      @Nonnull @CheckReturnValue default MessageSearchAction linkHostnames(@Nonnull String... linkHostnames)
      Keeps messages which have links from any of the provided hostnames, such as media.discordapp.com or jda.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 -
      • If the array or an element is null
      • If a hostname is larger than 256 characters
      • If there is more than 100 hostnames
    • 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 -
      • If the collection or an element is null
      • If a file name is larger than 256 characters
      • If there is more than 100 file names
    • 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 -
      • If the array or an element is null
      • If a file name is larger than 256 characters
      • If there is more than 100 file names
    • 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 -
      • If the collection or an element is null
      • If an extension is larger than 256 characters
      • If there is more than 100 extensions
    • 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 -
      • If the array or an element is null
      • If an extension is larger than 256 characters
      • If there is more than 100 extensions
    • sortBy

      @Nonnull @CheckReturnValue MessageSearchAction sortBy(@Nonnull MessageSearchAction.SortType sortType)
      Sorts messages by the provided sorting algorithm.
      The default is TIMESTAMP.
      Parameters:
      sortType - The sorting algorithm to use
      Returns:
      This action for chaining
      Throws:
      IllegalArgumentException - If the argument is null
    • sortOrder

      @Nonnull @CheckReturnValue MessageSearchAction sortOrder(@Nonnull MessageSearchAction.SortOrder sortOrder)
      Sorts messages by the provided sort order. This is only relevant when SortType.TIMESTAMP is used (the default).
      The default is DESC.
      Parameters:
      sortOrder - The sort order to use
      Returns:
      This action for chaining
      Throws:
      IllegalArgumentException - If the argument is null
    • includeNsfw

      @Nonnull @CheckReturnValue MessageSearchAction includeNsfw(boolean includeNsfw)
      Whether to include results from age-restricted channels.
      Default: false
      Parameters:
      includeNsfw - true to include age-restricted channels
      Returns:
      This action for chaining