Interface Message

    • Method Detail

      • crossPost

        static java.util.concurrent.CompletableFuture<Message> crossPost​(DiscordApi api,
                                                                         long channelId,
                                                                         long messageId)
        Cross posts the message if it is in an announcement channel.
        Parameters:
        api - The discord api instance.
        channelId - The id of the message's channel.
        messageId - The id of the message.
        Returns:
        The new message object.
      • crossPost

        default java.util.concurrent.CompletableFuture<Message> crossPost()
        Cross posts the message if it is in an announcement channel.
        Returns:
        The new message object.
      • delete

        static java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> delete​(DiscordApi api,
                                                                             java.lang.String channelId,
                                                                             java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> delete​(DiscordApi api,
                                                                             long channelId,
                                                                             long messageId,
                                                                             java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> delete​(DiscordApi api,
                                                                             java.lang.String channelId,
                                                                             java.lang.String messageId,
                                                                             java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> delete​(java.lang.String reason)
        Deletes the message.
        Specified by:
        delete in interface Deletable
        Parameters:
        reason - The audit log reason for the deletion.
        Returns:
        A future to tell us if the deletion was successful.
      • delete

        static java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> delete​(DiscordApi api,
                                                                             java.lang.String channelId,
                                                                             java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> delete​(DiscordApi api,
                                                                             java.lang.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 java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    long channelId,
                                                                    long messageId,
                                                                    java.lang.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 java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    java.lang.String channelId,
                                                                    java.lang.String messageId,
                                                                    java.lang.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 java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    long channelId,
                                                                    long messageId,
                                                                    EmbedBuilder... embeds)
        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.
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    long channelId,
                                                                    long messageId,
                                                                    java.util.List<EmbedBuilder> embeds)
        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.
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    java.lang.String channelId,
                                                                    java.lang.String messageId,
                                                                    EmbedBuilder... embeds)
        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.
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    java.lang.String channelId,
                                                                    java.lang.String messageId,
                                                                    java.util.List<EmbedBuilder> embeds)
        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.
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    long channelId,
                                                                    long messageId,
                                                                    java.lang.String content,
                                                                    EmbedBuilder... embeds)
        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.
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    long channelId,
                                                                    long messageId,
                                                                    java.lang.String content,
                                                                    java.util.List<EmbedBuilder> embeds)
        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.
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    java.lang.String channelId,
                                                                    java.lang.String messageId,
                                                                    java.lang.String content,
                                                                    EmbedBuilder... embeds)
        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.
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    java.lang.String channelId,
                                                                    java.lang.String messageId,
                                                                    java.lang.String content,
                                                                    java.util.List<EmbedBuilder> embeds)
        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.
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        static java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    long channelId,
                                                                    long messageId,
                                                                    java.lang.String content,
                                                                    boolean updateContent,
                                                                    java.util.List<EmbedBuilder> embeds,
                                                                    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.
        embeds - An array of the new embeds of the message.
        updateEmbed - Whether to update or remove the embed.
        Returns:
        A future to check if the update was successful.
      • edit

        static java.util.concurrent.CompletableFuture<Message> edit​(DiscordApi api,
                                                                    java.lang.String channelId,
                                                                    java.lang.String messageId,
                                                                    java.lang.String content,
                                                                    boolean updateContent,
                                                                    java.util.List<EmbedBuilder> embeds,
                                                                    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.
        embeds - An array of the new embeds of the message.
        updateEmbed - Whether to update or remove the embed.
        Returns:
        A future to check if the update was successful.
      • edit

        default java.util.concurrent.CompletableFuture<Message> edit​(java.lang.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 java.util.concurrent.CompletableFuture<Message> edit​(EmbedBuilder... embeds)
        Updates the embed of the message.
        Parameters:
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        default java.util.concurrent.CompletableFuture<Message> edit​(java.util.List<EmbedBuilder> embeds)
        Updates the embed of the message.
        Parameters:
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        default java.util.concurrent.CompletableFuture<Message> edit​(java.lang.String content,
                                                                     EmbedBuilder... embeds)
        Updates the content and the embed of the message.
        Parameters:
        content - The new content of the message.
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • edit

        default java.util.concurrent.CompletableFuture<Message> edit​(java.lang.String content,
                                                                     java.util.List<EmbedBuilder> embeds)
        Updates the content and the embed of the message.
        Parameters:
        content - The new content of the message.
        embeds - An array of the new embeds of the message.
        Returns:
        A future to check if the update was successful.
      • createUpdater

        default MessageUpdater createUpdater()
        Creates a new MessageUpdater for this message that can be used similarly to a builder to edit this message.
        Returns:
        the new message updater
      • removeContent

        static java.util.concurrent.CompletableFuture<Message> 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 java.util.concurrent.CompletableFuture<Message> removeContent​(DiscordApi api,
                                                                             java.lang.String channelId,
                                                                             java.lang.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 java.util.concurrent.CompletableFuture<Message> removeContent()
        Removes the content of the message.
        Returns:
        A future to check if the removal was successful.
      • removeEmbed

        static java.util.concurrent.CompletableFuture<Message> 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 java.util.concurrent.CompletableFuture<Message> removeEmbed​(DiscordApi api,
                                                                           java.lang.String channelId,
                                                                           java.lang.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 java.util.concurrent.CompletableFuture<Message> removeEmbed()
        Removes the embed of the message.
        Returns:
        A future to check if the removal was successful.
      • removeContentAndEmbed

        static java.util.concurrent.CompletableFuture<Message> 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 java.util.concurrent.CompletableFuture<Message> removeContentAndEmbed​(DiscordApi api,
                                                                                     java.lang.String channelId,
                                                                                     java.lang.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 java.util.concurrent.CompletableFuture<Message> removeContentAndEmbed()
        Removes the content and embed of the message.
        Returns:
        A future to check if the removal was successful.
      • addReaction

        static java.util.concurrent.CompletableFuture<java.lang.Void> addReaction​(DiscordApi api,
                                                                                  long channelId,
                                                                                  long messageId,
                                                                                  java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> addReaction​(DiscordApi api,
                                                                                  java.lang.String channelId,
                                                                                  java.lang.String messageId,
                                                                                  java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> addReaction​(java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> addReaction​(DiscordApi api,
                                                                                  java.lang.String channelId,
                                                                                  java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> removeAllReactions​(DiscordApi api,
                                                                                         java.lang.String channelId,
                                                                                         java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> removeAllReactions()
        Deletes all reactions on this message.
        Returns:
        A future to tell us if the deletion was successful.
      • pin

        static java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> pin​(DiscordApi api,
                                                                          java.lang.String channelId,
                                                                          java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> pin()
        Pins this message.
        Returns:
        A future to tell us if the pin was successful.
      • unpin

        static java.util.concurrent.CompletableFuture<java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> unpin​(DiscordApi api,
                                                                            java.lang.String channelId,
                                                                            java.lang.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 java.util.concurrent.CompletableFuture<java.lang.Void> unpin()
        Unpins this message.
        Returns:
        A future to tell us if the action was successful.
      • canYouReadContent

        boolean canYouReadContent()
        Checks if the bot can read the content of the message.
        Returns:
        Whether the bot can read the content of the message.
      • getContent

        java.lang.String getContent()
        Gets the content of the message.
        Returns:
        The content of the message.
        Throws:
        MissingIntentException - If not a single of the following requirements is met:
        • The bot has been mentioned in the message.
        • Your are the author of the message.
        • The message is a DM.
        • The Intent.MESSAGE_CONTENT has been enabled in your code and Discord Developer dashboard
      • getLastEditTimestamp

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

        java.util.List<MessageAttachment> getAttachments()
        Gets the attachments of the message.
        Returns:
        The attachments of the message.
        Throws:
        MissingIntentException - If not a single of the following requirements is met:
        • The bot has been mentioned in the message.
        • Your are the author of the message.
        • The message is a DM.
        • The Intent.MESSAGE_CONTENT has been enabled in your code and Discord Developer dashboard
      • getReadableContent

        default java.lang.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.
        Throws:
        MissingIntentException - If not a single of the following requirements is met:
        • The bot has been mentioned in the message.
        • Your are the author of the message.
        • The message is a DM.
        • The Intent.MESSAGE_CONTENT has been enabled in your code and Discord Developer dashboard
      • getLink

        default java.net.URL getLink()
                              throws java.lang.AssertionError
        Gets the link leading to this message.
        Returns:
        The message link.
        Throws:
        java.lang.AssertionError - If the link is malformed.
      • getCustomEmojis

        java.util.List<CustomEmoji> getCustomEmojis()
        Gets 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

        java.util.Optional<MessageActivity> getActivity()
        Gets the activity of the message.
        Returns:
        The activity of the message.
      • getFlags

        java.util.EnumSet<MessageFlag> getFlags()
        Gets the flags of the message.
        Returns:
        The flags 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

        java.util.List<Embed> getEmbeds()
        Gets all embeds of the message.
        Returns:
        All embeds of the message.
        Throws:
        MissingIntentException - If not a single of the following requirements is met:
        • The bot has been mentioned in the message.
        • Your are the author of the message.
        • The message is a DM.
        • The Intent.MESSAGE_CONTENT has been enabled in your code and Discord Developer dashboard
      • getUserAuthor

        java.util.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.
      • getMessageReference

        java.util.Optional<MessageReference> getMessageReference()
        Gets the message reference of the message.
        Returns:
        The message reference.
      • getReferencedMessage

        java.util.Optional<Message> getReferencedMessage()
        Gets the message referenced with a reply. Only present if this message is type MessageType.REPLY, discord decided to send it and the message hasn't been deleted.
        Returns:
        The referenced message.
      • requestReferencedMessage

        default java.util.Optional<java.util.concurrent.CompletableFuture<Message>> requestReferencedMessage()
        Requests the message referenced with a reply.

        If the message is in the cache, the message is served from the cache.

        Returns:
        The referenced 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 message is kept in cache forever.
        Parameters:
        cachedForever - Whether the message should be kept in cache forever or not.
      • getReactions

        java.util.List<Reaction> getReactions()
        Gets all reactions of the message.
        Returns:
        All reactions of the message.
      • getMessageInteraction

        java.util.Optional<MessageInteraction> getMessageInteraction()
        Gets the Message Interaction Object if the message is a response to an Interaction without an existing message.
        Returns:
        The Message Interaction Object.
      • getComponents

        java.util.List<HighLevelComponent> getComponents()
        Gets all components of the message.
        Returns:
        All components of the message.
        Throws:
        MissingIntentException - If not a single of the following requirements is met:
        • The bot has been mentioned in the message.
        • Your are the author of the message.
        • The message is a DM.
        • The Intent.MESSAGE_CONTENT has been enabled in your code and Discord Developer dashboard
      • getMentionedUsers

        java.util.List<User> getMentionedUsers()
        Gets all users mentioned in this message.
        Returns:
        All users mentioned in this message.
      • getMentionedRoles

        java.util.List<Role> getMentionedRoles()
        Gets all roles mentioned in this message.
        Returns:
        All roles mentioned in this message.
      • getNonce

        java.util.Optional<java.lang.String> getNonce()
        Gets the nonce of the message.
        Returns:
        The nonce of the message.
      • getStickerItems

        java.util.Set<StickerItem> getStickerItems()
        Gets the sticker items of the message.
        Returns:
        The sticker items of the message.
      • getPosition

        java.util.Optional<java.lang.Integer> getPosition()
        A generally increasing integer (there may be gaps or duplicates) that represents the approximate position of the message in a thread, it can be used to estimate the relative position of the message in a thread in company with ServerThreadChannel.getTotalNumberOfMessagesSent() on parent thread.
        Returns:
        The approximate position of the message in a thread.
      • getMentionedChannels

        default java.util.List<ServerChannel> getMentionedChannels()
        Gets all channels mentioned in this message.
        Returns:
        All channels mentioned in this message.
        Throws:
        MissingIntentException - If not a single of the following requirements is met:
        • The bot has been mentioned in the message.
        • Your are the author of the message.
        • The message is a DM.
        • The Intent.MESSAGE_CONTENT has been enabled in your code and Discord Developer dashboard
      • isPrivateMessage

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

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

        default boolean isThreadMessage()
        Checks if the message was sent in a thread channel.
        Returns:
        Whether the message was sent in a thread channel.
      • getReactionByEmoji

        default java.util.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 java.util.Optional<Reaction> getReactionByEmoji​(java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.CompletableFuture<java.lang.Void> addReactions​(java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionByEmoji​(User user,
                                                                                     java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionByEmoji​(java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionsByEmoji​(User user,
                                                                                      java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.CompletableFuture<java.lang.Void> removeReactionsByEmoji​(java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.CompletableFuture<java.lang.Void> removeOwnReactionByEmoji​(java.lang.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 java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.CompletableFuture<java.lang.Void> removeOwnReactionsByEmoji​(java.lang.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 java.util.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.
      • getServerThreadChannel

        default java.util.Optional<ServerThreadChannel> getServerThreadChannel()
        Gets the server thread channel of the message. Only present if the message was sent in a thread in a server.
        Returns:
        The server thread channel.
      • getPrivateChannel

        default java.util.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.
      • getServer

        default java.util.Optional<Server> getServer()
        Gets the server of the message.
        Returns:
        The server of the message.
      • getMessagesBeforeUntil

        default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBeforeUntil​(java.util.function.Predicate<Message> condition)
        Gets messages before this message until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesBefore(int, long), getMessagesBeforeAsStream()
      • getMessagesBeforeWhile

        default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBeforeWhile​(java.util.function.Predicate<Message> condition)
        Gets messages before this message while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        condition - The condition that has to be met.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesBeforeWhile(Predicate, long), getMessagesBeforeAsStream()
      • getMessagesBeforeAsStream

        default java.util.stream.Stream<Message> getMessagesBeforeAsStream()
        Gets a stream of messages before this message sorted from newest to oldest.

        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.getMessagesBeforeAsStream(long), getMessagesBefore(int)
      • getMessagesAfterUntil

        default java.util.concurrent.CompletableFuture<MessageSet> getMessagesAfterUntil​(java.util.function.Predicate<Message> condition)
        Gets messages after this message until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        condition - The abort condition for when to stop retrieving messages.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesAfter(int, long), getMessagesAfterAsStream()
      • getMessagesAfterWhile

        default java.util.concurrent.CompletableFuture<MessageSet> getMessagesAfterWhile​(java.util.function.Predicate<Message> condition)
        Gets messages after this message while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        condition - The condition that has to be met.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesAfterWhile(Predicate, long), getMessagesAfterAsStream()
      • getMessagesAfterAsStream

        default java.util.stream.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 java.util.concurrent.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 java.util.concurrent.CompletableFuture<MessageSet> getMessagesAroundUntil​(java.util.function.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 java.util.concurrent.CompletableFuture<MessageSet> getMessagesAroundWhile​(java.util.function.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 java.util.stream.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)
      • getMessagesBetweenUntil

        default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBetweenUntil​(long other,
                                                                                           java.util.function.Predicate<Message> condition)
        Gets all messages between this message and the given message, excluding the boundaries, until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        other - The id of the other boundary messages.
        condition - The abort condition for when to stop retrieving messages.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesBetweenUntil(Predicate, long, long), getMessagesBetweenAsStream(long)
      • getMessagesBetweenUntil

        default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBetweenUntil​(Message other,
                                                                                           java.util.function.Predicate<Message> condition)
        Gets all messages between this message and the given message, excluding the boundaries, until one that meets the given condition is found. If no message matches the condition, an empty set is returned.
        Parameters:
        other - The other boundary messages.
        condition - The abort condition for when to stop retrieving messages.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesBetweenUntil(Predicate, long, long), getMessagesBetweenAsStream(long)
      • getMessagesBetweenWhile

        default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBetweenWhile​(long other,
                                                                                           java.util.function.Predicate<Message> condition)
        Gets all messages between this message and the given message, excluding the boundaries, while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        other - The id of the other boundary messages.
        condition - The condition that has to be met.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesBetweenWhile(Predicate, long, long), getMessagesBetweenAsStream(long)
      • getMessagesBetweenWhile

        default java.util.concurrent.CompletableFuture<MessageSet> getMessagesBetweenWhile​(Message other,
                                                                                           java.util.function.Predicate<Message> condition)
        Gets all messages between this message and the given message, excluding the boundaries, while they meet the given condition. If the first message does not match the condition, an empty set is returned.
        Parameters:
        other - The other boundary messages.
        condition - The condition that has to be met.
        Returns:
        The messages.
        See Also:
        TextChannel.getMessagesBetweenWhile(Predicate, long, long), getMessagesBetweenAsStream(long)
      • getMessagesBetweenAsStream

        default java.util.stream.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 java.util.stream.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.
      • reply

        default java.util.concurrent.CompletableFuture<Message> reply​(java.lang.String messageContent)
        Replies to this message with the given text.
        Parameters:
        messageContent - The text to reply with.
        Returns:
        The message that was sent.
      • reply

        default java.util.concurrent.CompletableFuture<Message> reply​(java.lang.String messageContent,
                                                                      boolean assertReferenceExists)
        Replies to this message with the given text.
        Parameters:
        messageContent - The text to reply with.
        assertReferenceExists - If true, throw an error if the message you are replying to does not exist otherwise, if false send the message regardless without a reference to a message.
        Returns:
        The message that was sent.
      • reply

        default java.util.concurrent.CompletableFuture<Message> reply​(EmbedBuilder embed)
        Replies to this message with the given embed.
        Parameters:
        embed - The EmbedBuilder to reply with.
        Returns:
        The message that was sent.
      • reply

        default java.util.concurrent.CompletableFuture<Message> reply​(EmbedBuilder embed,
                                                                      boolean assertReferenceExists)
        Replies to this message with the given embed.
        Parameters:
        embed - The EmbedBuilder to reply with.
        assertReferenceExists - If true, throw an error if the message you are replying to does not exist otherwise, if false send the message regardless without a reference to a message.
        Returns:
        The message that was sent.
      • 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 java.util.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 java.util.concurrent.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.
      • createThread

        default java.util.concurrent.CompletableFuture<ServerThreadChannel> createThread​(java.lang.String name,
                                                                                         AutoArchiveDuration autoArchiveDuration)
        Creates a thread for this message.
        Parameters:
        name - The Thread name.
        autoArchiveDuration - Duration in minutes to automatically archive the thread after recent activity.
        Returns:
        The created ServerThreadChannel.
      • createThread

        default java.util.concurrent.CompletableFuture<ServerThreadChannel> createThread​(java.lang.String name,
                                                                                         java.lang.Integer autoArchiveDuration)
        Creates a thread for this message.
        Parameters:
        name - The Thread name.
        autoArchiveDuration - Duration in minutes to automatically archive the thread after recent activity.
        Returns:
        The created ServerThreadChannel.