Interface Message

    • Field Detail

      • ESCAPED_CHARACTER

        static final Pattern ESCAPED_CHARACTER
    • Method Detail

      • delete

        static CompletableFuture<Void> delete​(DiscordApi api,
                                              long channelId,
                                              long messageId)
        Deletes the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to tell us if the deletion was successful.
      • delete

        static CompletableFuture<Void> delete​(DiscordApi api,
                                              String channelId,
                                              String messageId)
        Deletes the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to tell us if the deletion was successful.
      • delete

        static CompletableFuture<Void> delete​(DiscordApi api,
                                              long channelId,
                                              long messageId,
                                              String reason)
        Deletes the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        reason - The audit log reason for the deletion.
        Returns:
        A future to tell us if the deletion was successful.
      • delete

        static CompletableFuture<Void> delete​(DiscordApi api,
                                              String channelId,
                                              String messageId,
                                              String reason)
        Deletes the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        reason - The audit log reason for the deletion.
        Returns:
        A future to tell us if the deletion was successful.
      • delete

        default CompletableFuture<Void> delete​()
        Deletes the message.
        Returns:
        A future to tell us if the deletion was successful.
      • delete

        default CompletableFuture<Void> delete​(String reason)
        Deletes the message.
        Parameters:
        reason - The audit log reason for the deletion.
        Returns:
        A future to tell us if the deletion was successful.
      • delete

        static CompletableFuture<Void> delete​(DiscordApi api,
                                              long channelId,
                                              long... messageIds)
        Deletes multiple messages at once. This method does not have a size or age restriction. Messages younger than two weeks are sent in batches of 100 messages to the bulk delete API, older messages are deleted with individual delete requests.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageIds - The ids of the messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • delete

        static CompletableFuture<Void> delete​(DiscordApi api,
                                              String channelId,
                                              String... messageIds)
        Deletes multiple messages at once. This method does not have a size or age restriction. Messages younger than two weeks are sent in batches of 100 messages to the bulk delete API, older messages are deleted with individual delete requests.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageIds - The ids of the messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • delete

        static CompletableFuture<Void> delete​(DiscordApi api,
                                              Message... messages)
        Deletes multiple messages at once. This method does not have a size or age restriction. Messages younger than two weeks are sent in batches of 100 messages to the bulk delete API, older messages are deleted with individual delete requests.
        Parameters:
        api - The discord api instance.
        messages - The messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • delete

        static CompletableFuture<Void> delete​(DiscordApi api,
                                              Iterable<Message> messages)
        Deletes multiple messages at once. This method does not have a size or age restriction. Messages younger than two weeks are sent in batches of 100 messages to the bulk delete API, older messages are deleted with individual delete requests.
        Parameters:
        api - The discord api instance.
        messages - The messages to delete.
        Returns:
        A future to tell us if the deletion was successful.
      • edit

        static CompletableFuture<Void> edit​(DiscordApi api,
                                            long channelId,
                                            long messageId,
                                            String content)
        Updates the content of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        content - The new content of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static CompletableFuture<Void> edit​(DiscordApi api,
                                            String channelId,
                                            String messageId,
                                            String content)
        Updates the content of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        content - The new content of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static CompletableFuture<Void> edit​(DiscordApi api,
                                            long channelId,
                                            long messageId,
                                            EmbedBuilder embed)
        Updates the embed of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        embed - The new embed of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static CompletableFuture<Void> edit​(DiscordApi api,
                                            String channelId,
                                            String messageId,
                                            EmbedBuilder embed)
        Updates the embed of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        embed - The new embed of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static CompletableFuture<Void> edit​(DiscordApi api,
                                            long channelId,
                                            long messageId,
                                            String content,
                                            EmbedBuilder embed)
        Updates the content and the embed of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        content - The new content of the message.
        embed - The new embed of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static CompletableFuture<Void> edit​(DiscordApi api,
                                            String channelId,
                                            String messageId,
                                            String content,
                                            EmbedBuilder embed)
        Updates the content and the embed of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        content - The new content of the message.
        embed - The new embed of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static CompletableFuture<Void> edit​(DiscordApi api,
                                            long channelId,
                                            long messageId,
                                            String content,
                                            boolean updateContent,
                                            EmbedBuilder embed,
                                            boolean updateEmbed)
        Updates the content and the embed of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        content - The new content of the message.
        updateContent - Whether to update or remove the content.
        embed - The new embed of the message.
        updateEmbed - Whether to update or remove the embed.
        Returns:
        A future to check if the update was successful.
      • edit

        static CompletableFuture<Void> edit​(DiscordApi api,
                                            String channelId,
                                            String messageId,
                                            String content,
                                            boolean updateContent,
                                            EmbedBuilder embed,
                                            boolean updateEmbed)
        Updates the content and the embed of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        content - The new content of the message.
        updateContent - Whether to update or remove the content.
        embed - The new embed of the message.
        updateEmbed - Whether to update or remove the embed.
        Returns:
        A future to check if the update was successful.
      • edit

        default CompletableFuture<Void> edit​(String content)
        Updates the content of the message.
        Parameters:
        content - The new content of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        default CompletableFuture<Void> edit​(EmbedBuilder embed)
        Updates the embed of the message.
        Parameters:
        embed - The new embed of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        default CompletableFuture<Void> edit​(String content,
                                             EmbedBuilder embed)
        Updates the content and the embed of the message.
        Parameters:
        content - The new content of the message.
        embed - The new embed of the message.
        Returns:
        A future to check if the update was successful.
      • removeContent

        static CompletableFuture<Void> removeContent​(DiscordApi api,
                                                     long channelId,
                                                     long messageId)
        Removes the content of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to check if the removal was successful.
      • removeContent

        static CompletableFuture<Void> removeContent​(DiscordApi api,
                                                     String channelId,
                                                     String messageId)
        Removes the content of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to check if the removal was successful.
      • removeContent

        default CompletableFuture<Void> removeContent​()
        Removes the content of the message.
        Returns:
        A future to check if the removal was successful.
      • removeEmbed

        static CompletableFuture<Void> removeEmbed​(DiscordApi api,
                                                   long channelId,
                                                   long messageId)
        Removes the embed of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to check if the removal was successful.
      • removeEmbed

        static CompletableFuture<Void> removeEmbed​(DiscordApi api,
                                                   String channelId,
                                                   String messageId)
        Removes the embed of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to check if the removal was successful.
      • removeEmbed

        default CompletableFuture<Void> removeEmbed​()
        Removes the embed of the message.
        Returns:
        A future to check if the removal was successful.
      • removeContentAndEmbed

        static CompletableFuture<Void> removeContentAndEmbed​(DiscordApi api,
                                                             long channelId,
                                                             long messageId)
        Removes the content and embed of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to check if the removal was successful.
      • removeContentAndEmbed

        static CompletableFuture<Void> removeContentAndEmbed​(DiscordApi api,
                                                             String channelId,
                                                             String messageId)
        Removes the content and embed of the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to check if the removal was successful.
      • removeContentAndEmbed

        default CompletableFuture<Void> removeContentAndEmbed​()
        Removes the content and embed of the message.
        Returns:
        A future to check if the removal was successful.
      • addReaction

        static CompletableFuture<Void> addReaction​(DiscordApi api,
                                                   long channelId,
                                                   long messageId,
                                                   String unicodeEmoji)
        Adds a unicode reaction to the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        unicodeEmoji - The unicode emoji string.
        Returns:
        A future to tell us if the action was successful.
      • addReaction

        static CompletableFuture<Void> addReaction​(DiscordApi api,
                                                   String channelId,
                                                   String messageId,
                                                   String unicodeEmoji)
        Adds a unicode reaction to the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        unicodeEmoji - The unicode emoji string.
        Returns:
        A future to tell us if the action was successful.
      • addReaction

        default CompletableFuture<Void> addReaction​(Emoji emoji)
        Adds a reaction to the message.
        Parameters:
        emoji - The emoji.
        Returns:
        A future to tell us if the action was successful.
      • addReaction

        static CompletableFuture<Void> addReaction​(DiscordApi api,
                                                   long channelId,
                                                   long messageId,
                                                   Emoji emoji)
        Adds a reaction to the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        emoji - The emoji.
        Returns:
        A future to tell us if the action was successful.
      • addReaction

        default CompletableFuture<Void> addReaction​(String unicodeEmoji)
        Adds a unicode reaction to the message.
        Parameters:
        unicodeEmoji - The unicode emoji string.
        Returns:
        A future to tell us if the action was successful.
      • addReaction

        static CompletableFuture<Void> addReaction​(DiscordApi api,
                                                   String channelId,
                                                   String messageId,
                                                   Emoji emoji)
        Adds a reaction to the message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        emoji - The emoji.
        Returns:
        A future to tell us if the action was successful.
      • removeAllReactions

        static CompletableFuture<Void> removeAllReactions​(DiscordApi api,
                                                          long channelId,
                                                          long messageId)
        Deletes all reactions on this message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to tell us if the deletion was successful.
      • removeAllReactions

        static CompletableFuture<Void> removeAllReactions​(DiscordApi api,
                                                          String channelId,
                                                          String messageId)
        Deletes all reactions on this message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to tell us if the deletion was successful.
      • removeAllReactions

        default CompletableFuture<Void> removeAllReactions​()
        Deletes all reactions on this message.
        Returns:
        A future to tell us if the deletion was successful.
      • pin

        static CompletableFuture<Void> pin​(DiscordApi api,
                                           long channelId,
                                           long messageId)
        Pins this message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to tell us if the pin was successful.
      • pin

        static CompletableFuture<Void> pin​(DiscordApi api,
                                           String channelId,
                                           String messageId)
        Pins this message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to tell us if the pin was successful.
      • pin

        default CompletableFuture<Void> pin​()
        Pins this message.
        Returns:
        A future to tell us if the pin was successful.
      • unpin

        static CompletableFuture<Void> unpin​(DiscordApi api,
                                             long channelId,
                                             long messageId)
        Unpins this message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to tell us if the action was successful.
      • unpin

        static CompletableFuture<Void> unpin​(DiscordApi api,
                                             String channelId,
                                             String messageId)
        Unpins this message.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        A future to tell us if the action was successful.
      • unpin

        default CompletableFuture<Void> unpin​()
        Unpins this message.
        Returns:
        A future to tell us if the action was successful.
      • getContent

        String getContent​()
        Gets the content of the message.
        Returns:
        The content of the message.
      • getLastEditTimestamp

        Optional<Instant> getLastEditTimestamp​()
        Gets the last time the message was edited.
        Returns:
        The last time the message was edited.
      • getAttachments

        List<MessageAttachment> getAttachments​()
        Gets the attachments of the message.
        Returns:
        The attachments of the message.
      • getReadableContent

        default String getReadableContent​()
        Gets the readable content of the message, which replaces all mentions etc. with the actual name. The replacement happens as following:
        • User mentions: @nickname if the user has a nickname, @name if the user has no nickname, unchanged if the user is not in the cache.
        • Role mentions: @name if the role exists in the server, otherwise #deleted-role
        • Channel mentions: #name if the text channel exists in the server, otherwise #deleted-channel
        • Custom emoji: :name:. If the emoji is known, the real name is used, otherwise the name from the mention tag.
        Returns:
        The readable content of the message.
      • getCustomEmojis

        List<CustomEmoji> getCustomEmojis​()
        Gets a list of all custom emojis in the message.
        Returns:
        The list of custom emojis in the message.
      • getType

        MessageType getType​()
        Gets the type of the message.
        Returns:
        The type of the message.
      • getChannel

        TextChannel getChannel​()
        Gets the text channel of the message.
        Returns:
        The text channel of the message.
      • getActivity

        Optional<MessageActivity> getActivity​()
        Gets the activity of the message.
        Returns:
        The activity of the message.
      • isPinned

        boolean isPinned​()
        Checks if the message is pinned.
        Returns:
        Whether the message is pinned or not.
      • isTts

        boolean isTts​()
        Checks if this message is text-to-speech.
        Returns:
        Whether this message is text-to-speech or not.
      • mentionsEveryone

        boolean mentionsEveryone​()
        Checks if the message mentions everyone.
        Returns:
        Whether the message mentions everyone or not.
      • getEmbeds

        List<Embed> getEmbeds​()
        Gets a list with all embeds of the message.
        Returns:
        A list with all embeds of the message.
      • getUserAuthor

        Optional<User> getUserAuthor​()
        Gets the user author of the message. The author is not present, if it's a webhook.
        Returns:
        The user author of the message.
      • getAuthor

        MessageAuthor getAuthor​()
        Gets the author of the message. Might be a user or a webhook.
        Returns:
        The author of the message.
      • isCachedForever

        boolean isCachedForever​()
        Checks if the message is kept in cache forever.
        Returns:
        Whether the message is kept in cache forever or not.
      • setCachedForever

        void setCachedForever​(boolean cachedForever)
        Sets if the the message is kept in cache forever.
        Parameters:
        cachedForever - Whether the message should be kept in cache forever or not.
      • getReactions

        List<Reaction> getReactions​()
        Gets a list with all reactions of the message.
        Returns:
        A list which contains all reactions of the message.
      • getMentionedUsers

        List<User> getMentionedUsers​()
        Gets a list with all users mentioned in this message.
        Returns:
        A list with all users mentioned in this message.
      • getMentionedRoles

        List<Role> getMentionedRoles​()
        Gets a list with all roles mentioned in this message.
        Returns:
        A list with all roles mentioned in this message.
      • getMentionedChannels

        default List<ServerTextChannel> getMentionedChannels​()
        Gets a list with all channels mentioned in this message.
        Returns:
        A list with all channels mentioned in this message.
      • isPrivate

        @Deprecated
        default boolean isPrivate​()
        Deprecated. Use isPrivateMessage() instead.
        Checks if the message was sent in a private channel.
        Returns:
        Whether or not the message was sent in a private channel.
      • isPrivateMessage

        default boolean isPrivateMessage​()
        Checks if the message was sent in a private channel.
        Returns:
        Whether or not the message was sent in a private channel.
      • isServerMessage

        default boolean isServerMessage​()
        Checks if the message was sent in a server channel.
        Returns:
        Whether or not the message was sent in a server channel.
      • isGroupMessage

        default boolean isGroupMessage​()
        Checks if the message was sent in a group channel.
        Returns:
        Whether or not the message was sent in a group channel.
      • getReactionByEmoji

        default Optional<Reaction> getReactionByEmoji​(Emoji emoji)
        Gets a reaction by its emoji.
        Parameters:
        emoji - The emoji of the reaction.
        Returns:
        The reaction for the given emoji.
      • getReactionByEmoji

        default Optional<Reaction> getReactionByEmoji​(String unicodeEmoji)
        Gets a reaction by its unicode emoji.
        Parameters:
        unicodeEmoji - The unicode emoji of the reaction.
        Returns:
        The reaction for the given emoji.
      • addReactions

        default CompletableFuture<Void> addReactions​(Emoji... emojis)
        Adds reactions to the message.
        Parameters:
        emojis - The emojis.
        Returns:
        A future to tell us if the action was successful.
      • addReactions

        CompletableFuture<Void> addReactions​(String... unicodeEmojis)
        Adds unicode reactions to the message.
        Parameters:
        unicodeEmojis - The unicode emoji strings.
        Returns:
        A future to tell us if the action was successful.
      • removeReactionByEmoji

        default CompletableFuture<Void> removeReactionByEmoji​(User user,
                                                              Emoji emoji)
        Removes a user from the list of reactors of a given emoji reaction.
        Parameters:
        user - The user to remove.
        emoji - The emoji of the reaction.
        Returns:
        A future to tell us if the deletion was successful.
      • removeReactionByEmoji

        CompletableFuture<Void> removeReactionByEmoji​(User user,
                                                      String unicodeEmoji)
        Removes a user from the list of reactors of a given unicode emoji reaction.
        Parameters:
        user - The user to remove.
        unicodeEmoji - The unicode emoji of the reaction.
        Returns:
        A future to tell us if the deletion was successful.
      • removeReactionByEmoji

        default CompletableFuture<Void> removeReactionByEmoji​(Emoji emoji)
        Removes all reactors of a given emoji reaction.
        Parameters:
        emoji - The emoji of the reaction.
        Returns:
        A future to tell us if the deletion was successful.
      • removeReactionByEmoji

        CompletableFuture<Void> removeReactionByEmoji​(String unicodeEmoji)
        Removes all reactors of a given unicode emoji reaction.
        Parameters:
        unicodeEmoji - The unicode emoji of the reaction.
        Returns:
        A future to tell us if the deletion was successful.
      • removeReactionsByEmoji

        default CompletableFuture<Void> removeReactionsByEmoji​(User user,
                                                               Emoji... emojis)
        Removes a user from the list of reactors of the given emoji reactions.
        Parameters:
        user - The user to remove.
        emojis - The emojis of the reactions.
        Returns:
        A future to tell us if the deletion was successful.
      • removeReactionsByEmoji

        CompletableFuture<Void> removeReactionsByEmoji​(User user,
                                                       String... unicodeEmojis)
        Removes a user from the list of reactors of the given unicode emoji reactions.
        Parameters:
        unicodeEmojis - The unicode emojis of the reactions.
        user - The user to remove.
        Returns:
        A future to tell us if the deletion was successful.
      • removeReactionsByEmoji

        default CompletableFuture<Void> removeReactionsByEmoji​(Emoji... emojis)
        Removes all reactors of the given emoji reactions.
        Parameters:
        emojis - The emojis of the reactions.
        Returns:
        A future to tell us if the deletion was successful.
      • removeReactionsByEmoji

        CompletableFuture<Void> removeReactionsByEmoji​(String... unicodeEmojis)
        Removes all reactors of the given unicode emoji reactions.
        Parameters:
        unicodeEmojis - The unicode emojis of the reactions.
        Returns:
        A future to tell us if the deletion was successful.
      • removeOwnReactionByEmoji

        default CompletableFuture<Void> removeOwnReactionByEmoji​(Emoji emoji)
        Removes you from the list of reactors of a given emoji reaction.
        Parameters:
        emoji - The emoji of the reaction.
        Returns:
        A future to tell us if the deletion was successful.
      • removeOwnReactionByEmoji

        CompletableFuture<Void> removeOwnReactionByEmoji​(String unicodeEmoji)
        Removes you from the list of reactors of a given unicode emoji reaction.
        Parameters:
        unicodeEmoji - The unicode emoji of the reaction.
        Returns:
        A future to tell us if the deletion was successful.
      • removeOwnReactionsByEmoji

        default CompletableFuture<Void> removeOwnReactionsByEmoji​(Emoji... emojis)
        Removes you from the list of reactors of the given emoji reactions.
        Parameters:
        emojis - The emojis of the reactions.
        Returns:
        A future to tell us if the deletion was successful.
      • removeOwnReactionsByEmoji

        CompletableFuture<Void> removeOwnReactionsByEmoji​(String... unicodeEmojis)
        Removes you from the list of reactors of the given unicode emoji reactions.
        Parameters:
        unicodeEmojis - The unicode emojis of the reactions.
        Returns:
        A future to tell us if the deletion was successful.
      • getServerTextChannel

        default Optional<ServerTextChannel> getServerTextChannel​()
        Gets the server text channel of the message. Only present if the message was sent in a server.
        Returns:
        The server text channel.
      • getPrivateChannel

        default Optional<PrivateChannel> getPrivateChannel​()
        Gets the private channel of the message. Only present if the message was sent in a private conversation.
        Returns:
        The private channel.
      • getGroupChannel

        default Optional<GroupChannel> getGroupChannel​()
        Gets the group channel of the message. Only present if the message was sent in a group channel.
        Returns:
        The group channel.
      • getServer

        default Optional<Server> getServer​()
        Gets the server of the message.
        Returns:
        The server of the message.
      • getMessagesAfterAsStream

        default Stream<Message> getMessagesAfterAsStream​()
        Gets a stream of messages after this message sorted from oldest to newest.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Returns:
        The stream.
        See Also:
        TextChannel.getMessagesAfterAsStream(long), getMessagesAfter(int)
      • getMessagesAround

        default CompletableFuture<MessageSet> getMessagesAround​(int limit)
        Gets up to a given amount of messages around this message. This message will be part of the result in addition to the messages around and does not count towards the limit. Half of the messages will be older than this message and half of the message will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.
        Parameters:
        limit - The limit of messages to get.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesAround(int, long), getMessagesAroundAsStream()
      • getMessagesAroundUntil

        default CompletableFuture<MessageSet> getMessagesAroundUntil​(Predicate<Message> condition)
        Gets messages around this message until one that meets the given condition is found. If no message matches the condition, an empty set is returned. This message will be part of the result in addition to the messages around and is matched against the condition and will abort retrieval. Half of the messages will be older than this message and half of the message will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesAround(int, long), getMessagesAroundAsStream()
      • getMessagesAroundWhile

        default CompletableFuture<MessageSet> getMessagesAroundWhile​(Predicate<Message> condition)
        Gets messages around this message while they meet the given condition. If this message does not match the condition, an empty set is returned. This message will be part of the result in addition to the messages around and is matched against the condition and will abort retrieval. Half of the messages will be older than this message and half of the message will be newer. If there aren't enough older or newer messages, the actual amount of messages will be less than the given limit. It's also not guaranteed to be perfectly balanced.
        Parameters:
        condition - The condition that has to be met.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesAroundWhile(Predicate, long), getMessagesAroundAsStream()
      • getMessagesAroundAsStream

        default Stream<Message> getMessagesAroundAsStream​()
        Gets a stream of messages around this message. The first message in the stream will be this message. After that you will always get an older message and a newer message alternating as long as on both sides messages are available. If only on one side further messages are available, only those are delivered further on. It's not guaranteed to be perfectly balanced.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Returns:
        The stream.
        See Also:
        TextChannel.getMessagesAroundAsStream(long), getMessagesAround(int)
      • getMessagesBetweenAsStream

        default Stream<Message> getMessagesBetweenAsStream​(long other)
        Gets a stream of all messages between this message and the given message, excluding the boundaries, sorted from this message to the given message.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Parameters:
        other - The id of the other boundary messages.
        Returns:
        The stream.
        See Also:
        TextChannel.getMessagesBetweenAsStream(long, long), getMessagesBetween(long)
      • getMessagesBetweenAsStream

        default Stream<Message> getMessagesBetweenAsStream​(Message other)
        Gets a stream of all messages between this message and the given message, excluding the boundaries, sorted from this message to the given message.

        The messages are retrieved in batches synchronously from Discord, so consider not using this method from a listener directly.

        Parameters:
        other - The other boundary messages.
        Returns:
        The stream.
        See Also:
        TextChannel.getMessagesBetweenAsStream(long, long), getMessagesBetween(long)
      • canAddNewReactions

        default boolean canAddNewReactions​(User user)
        Checks if the given user is allowed to add new reactions to the message.
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user is allowed to add new reactions to the message or not.
      • canYouAddNewReactions

        default boolean canYouAddNewReactions​()
        Checks if the user of the connected account is allowed to add new reactions to the message.
        Returns:
        Whether the user of the connected account is allowed to add new reactions to the message or not.
      • canDelete

        default boolean canDelete​(User user)
        Checks if the given user can delete this message.
        Parameters:
        user - The user to check.
        Returns:
        Whether the given user can delete the message or not.
      • canYouDelete

        default boolean canYouDelete​()
        Checks if the user of the connected account can delete this message.
        Returns:
        Whether the user of the connected account can delete the message or not.
      • getCurrentCachedInstance

        default Optional<Message> getCurrentCachedInstance​()
        Description copied from interface: UpdatableFromCache
        Gets an updated instance of this entity from the cache. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache, that gets updates from Discord, in case this one was invalidated.

        This method returns the currently cached entity, or an empty Optional if the entity is not cached any longer, for example because it was deleted or the message was thrown out of the cache.

        Specified by:
        getCurrentCachedInstance in interface UpdatableFromCache<Message>
        Returns:
        The current cached instance.
      • getLatestInstance

        default CompletableFuture<Message> getLatestInstance​()
        Description copied from interface: Updatable
        Gets an updated instance of this entity from the cache or from Discord directly. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache if present or from Discord directly.

        This method returns the currently cached entity if present, or request the entity from Discord if it is not cached or not permanently cached. If the entity is a fully cached entity and is not in the cache any longer, for example because it was deleted or the message was thrown out of the cache, the CompletableFuture completes exceptionally with a NoSuchElementException. If a request to Discord is made, the according remote call exception will be used to complete the CompletableFuture exceptionally.

        Specified by:
        getLatestInstance in interface Updatable<Message>
        Specified by:
        getLatestInstance in interface UpdatableFromCache<Message>
        Returns:
        The current cached instance.