Interface MessageBuilderBaseDelegate

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addActionRow​(LowLevelComponent... lowLevelComponents)
      Add low-level components to the message, wrapped in an ActionRow.
      void addAttachment​(byte[] bytes, java.lang.String fileName)
      Adds an attachment to the message.
      void addAttachment​(java.awt.image.BufferedImage image, java.lang.String fileName)
      Adds an attachment to the message.
      void addAttachment​(java.io.File file)
      Adds an attachment to the message.
      void addAttachment​(java.io.InputStream stream, java.lang.String fileName)
      Adds an attachment to the message.
      void addAttachment​(java.net.URL url)
      Adds an attachment to the message.
      void addAttachment​(Icon icon)
      Adds an attachment to the message.
      void addAttachmentAsSpoiler​(java.io.File file)
      Adds a spoiler attachment to the message.
      void addAttachmentAsSpoiler​(java.net.URL url)
      Adds a spoiler attachment to the message.
      void addAttachmentAsSpoiler​(Icon icon)
      Adds a spoiler attachment to the message.
      void addComponents​(HighLevelComponent... highLevelComponents)
      Add high-level components to the message.
      void addEmbed​(EmbedBuilder embed)
      Adds the embed to the message.
      void addEmbeds​(java.util.List<EmbedBuilder> embeds)
      Adds the embeds to the message.
      void addFile​(byte[] bytes, java.lang.String fileName)
      Adds a file to the message.
      void addFile​(java.awt.image.BufferedImage image, java.lang.String fileName)
      Adds a file to the message.
      void addFile​(java.io.File file)
      Adds a file to the message.
      void addFile​(java.io.InputStream stream, java.lang.String fileName)
      Adds a file to the message.
      void addFile​(java.net.URL url)
      Adds a file to the message.
      void addFile​(Icon icon)
      Adds a file to the message.
      void addFileAsSpoiler​(java.io.File file)
      Adds a spoiler attachment to the message.
      void addFileAsSpoiler​(java.net.URL url)
      Adds a spoiler attachment to the message.
      void addFileAsSpoiler​(Icon icon)
      Adds a spoiler attachment to the message.
      void addSticker​(long stickerId)
      Adds a sticker to the message.
      void addStickers​(java.util.Collection<java.lang.Long> stickerIds)
      Adds stickers to the message.
      void append​(java.lang.Object object)
      Appends the string representation of the object (calling String.valueOf(Object) method) to the message.
      void append​(java.lang.String message, MessageDecoration... decorations)
      Appends a sting with or without decoration to the message.
      void append​(Mentionable entity)
      Appends a mentionable entity (usually a user or channel) to the message.
      void appendCode​(java.lang.String language, java.lang.String code)
      Appends code to the message.
      void appendNamedLink​(java.lang.String name, java.lang.String url)
      Appends a named link to the message.
      void appendNewLine()
      Appends a new line to the message.
      void copy​(Message message)
      Fill the builder's values with a given message.
      java.util.concurrent.CompletableFuture<Message> edit​(Message message, boolean allFields)
      Edits the message.
      java.lang.StringBuilder getStringBuilder()
      Gets the StringBuilder which is used to build the message.
      void removeAllComponents()
      Remove all high-level components from the message.
      void removeAllEmbeds()
      Removes all embeds from the message.
      void removeComponent​(int index)
      Remove a high-level component from the message.
      void removeComponent​(HighLevelComponent component)
      Remove a high-level component from the message.
      void removeEmbed​(EmbedBuilder embed)
      Removes the embed from the message.
      void removeEmbeds​(EmbedBuilder... embeds)
      Removes the embeds from the message.
      void replyTo​(long messageId)
      Sets the message to reply to.
      java.util.concurrent.CompletableFuture<Message> send​(TextChannel channel)
      Sends the message.
      java.util.concurrent.CompletableFuture<Message> send​(Messageable messageable)
      Sends the message.
      java.util.concurrent.CompletableFuture<Message> send​(User user)
      Sends the message.
      java.util.concurrent.CompletableFuture<Message> send​(IncomingWebhook webhook)
      Sends the message.
      java.util.concurrent.CompletableFuture<Message> sendWithWebhook​(DiscordApi api, java.lang.String webhookId, java.lang.String webhookToken)
      Sends the message.
      void setAllowedMentions​(AllowedMentions allowedMentions)
      Controls the mention behavior.
      void setContent​(java.lang.String content)
      Sets the content of the message.
      void setNonce​(java.lang.String nonce)
      Sets the nonce of the message.
      void setTts​(boolean tts)
      Sets if the message should be text to speech.
    • Method Detail

      • addComponents

        void addComponents​(HighLevelComponent... highLevelComponents)
        Add high-level components to the message.
        Parameters:
        highLevelComponents - The high-level components.
      • addActionRow

        void addActionRow​(LowLevelComponent... lowLevelComponents)
        Add low-level components to the message, wrapped in an ActionRow.
        Parameters:
        lowLevelComponents - The low level components.
      • appendCode

        void appendCode​(java.lang.String language,
                        java.lang.String code)
        Appends code to the message.
        Parameters:
        language - The language, e.g. "java".
        code - The code.
      • append

        void append​(java.lang.String message,
                    MessageDecoration... decorations)
        Appends a sting with or without decoration to the message.
        Parameters:
        message - The string to append.
        decorations - The decorations of the string.
      • append

        void append​(Mentionable entity)
        Appends a mentionable entity (usually a user or channel) to the message.
        Parameters:
        entity - The entity to mention.
      • append

        void append​(java.lang.Object object)
        Appends the string representation of the object (calling String.valueOf(Object) method) to the message.
        Parameters:
        object - The object to append.
        See Also:
        StringBuilder.append(Object)
      • appendNamedLink

        void appendNamedLink​(java.lang.String name,
                             java.lang.String url)
        Appends a named link to the message.
        Parameters:
        name - The name of the link.
        url - The URL of the link.
      • appendNewLine

        void appendNewLine()
        Appends a new line to the message.
      • copy

        void copy​(Message message)
        Fill the builder's values with a given message.
        Parameters:
        message - The message to copy from.
      • setContent

        void setContent​(java.lang.String content)
        Sets the content of the message. This method overwrites all previous content changes (using append(String, MessageDecoration...) for example).
        Parameters:
        content - The new content of the message.
      • addEmbed

        void addEmbed​(EmbedBuilder embed)
        Adds the embed to the message.
        Parameters:
        embed - The embed to add.
      • removeAllEmbeds

        void removeAllEmbeds()
        Removes all embeds from the message.
      • addEmbeds

        void addEmbeds​(java.util.List<EmbedBuilder> embeds)
        Adds the embeds to the message.
        Parameters:
        embeds - The embeds to add.
      • removeEmbed

        void removeEmbed​(EmbedBuilder embed)
        Removes the embed from the message.
        Parameters:
        embed - The embed to remove.
      • removeEmbeds

        void removeEmbeds​(EmbedBuilder... embeds)
        Removes the embeds from the message.
        Parameters:
        embeds - The embeds to remove.
      • removeComponent

        void removeComponent​(int index)
        Remove a high-level component from the message.
        Parameters:
        index - The index placement.
      • removeComponent

        void removeComponent​(HighLevelComponent component)
        Remove a high-level component from the message.
        Parameters:
        component - The high-level component being removed.
      • removeAllComponents

        void removeAllComponents()
        Remove all high-level components from the message.
      • setTts

        void setTts​(boolean tts)
        Sets if the message should be text to speech.
        Parameters:
        tts - Whether the message should be text to speech or not.
      • addFile

        void addFile​(java.awt.image.BufferedImage image,
                     java.lang.String fileName)
        Adds a file to the message.
        Parameters:
        image - The image to add as an attachment.
        fileName - The file name of the image.
        See Also:
        addAttachment(BufferedImage, String)
      • addFile

        void addFile​(java.io.File file)
        Adds a file to the message.
        Parameters:
        file - The file to add as an attachment.
        See Also:
        addAttachment(File)
      • addFile

        void addFile​(Icon icon)
        Adds a file to the message.
        Parameters:
        icon - The icon to add as an attachment.
        See Also:
        addAttachment(Icon)
      • addFile

        void addFile​(java.net.URL url)
        Adds a file to the message.
        Parameters:
        url - The url of the attachment.
        See Also:
        addAttachment(URL)
      • addFile

        void addFile​(byte[] bytes,
                     java.lang.String fileName)
        Adds a file to the message.
        Parameters:
        bytes - The bytes of the file.
        fileName - The name of the file.
        See Also:
        addAttachment(byte[], String)
      • addFile

        void addFile​(java.io.InputStream stream,
                     java.lang.String fileName)
        Adds a file to the message.
        Parameters:
        stream - The stream of the file.
        fileName - The name of the file.
        See Also:
        addAttachment(InputStream, String)
      • addFileAsSpoiler

        void addFileAsSpoiler​(java.io.File file)
        Adds a spoiler attachment to the message.
        Parameters:
        file - The file to add as an attachment.
      • addFileAsSpoiler

        void addFileAsSpoiler​(Icon icon)
        Adds a spoiler attachment to the message.
        Parameters:
        icon - The icon to add as an attachment.
      • addFileAsSpoiler

        void addFileAsSpoiler​(java.net.URL url)
        Adds a spoiler attachment to the message.
        Parameters:
        url - The url of the attachment.
      • addAttachment

        void addAttachment​(java.awt.image.BufferedImage image,
                           java.lang.String fileName)
        Adds an attachment to the message.
        Parameters:
        image - The image to add as an attachment.
        fileName - The file name of the image.
      • addAttachment

        void addAttachment​(java.io.File file)
        Adds an attachment to the message.
        Parameters:
        file - The file to add as an attachment.
      • addAttachment

        void addAttachment​(Icon icon)
        Adds an attachment to the message.
        Parameters:
        icon - The icon to add as an attachment.
      • addAttachment

        void addAttachment​(java.net.URL url)
        Adds an attachment to the message.
        Parameters:
        url - The url of the attachment.
      • addAttachment

        void addAttachment​(byte[] bytes,
                           java.lang.String fileName)
        Adds an attachment to the message.
        Parameters:
        bytes - The bytes of the file.
        fileName - The name of the file.
      • addAttachment

        void addAttachment​(java.io.InputStream stream,
                           java.lang.String fileName)
        Adds an attachment to the message.
        Parameters:
        stream - The stream of the file.
        fileName - The name of the file.
      • addAttachmentAsSpoiler

        void addAttachmentAsSpoiler​(java.io.File file)
        Adds a spoiler attachment to the message.
        Parameters:
        file - The file to add as an attachment.
      • addAttachmentAsSpoiler

        void addAttachmentAsSpoiler​(Icon icon)
        Adds a spoiler attachment to the message.
        Parameters:
        icon - The icon to add as an attachment.
      • addAttachmentAsSpoiler

        void addAttachmentAsSpoiler​(java.net.URL url)
        Adds a spoiler attachment to the message.
        Parameters:
        url - The url of the attachment.
      • setAllowedMentions

        void setAllowedMentions​(AllowedMentions allowedMentions)
        Controls the mention behavior.
        Parameters:
        allowedMentions - The mention object to specify which mention should ping.
      • replyTo

        void replyTo​(long messageId)
        Sets the message to reply to.
        Parameters:
        messageId - The id of the message to reply to.
      • setNonce

        void setNonce​(java.lang.String nonce)
        Sets the nonce of the message.
        Parameters:
        nonce - The nonce to set.
      • addSticker

        void addSticker​(long stickerId)
        Adds a sticker to the message. This will only work if the sticker is from the same server as the message will be sent on, or if it is a default sticker.
        Parameters:
        stickerId - The ID of the sticker to add.
      • addStickers

        void addStickers​(java.util.Collection<java.lang.Long> stickerIds)
        Adds stickers to the message. You can add up to 3 different stickers per message. Adding the same sticker twice or more will just add the sticker once. This will only work if the stickers are from the same server as the message will be sent on, or if they are default stickers.
        Parameters:
        stickerIds - The stickers to add.
      • getStringBuilder

        java.lang.StringBuilder getStringBuilder()
        Gets the StringBuilder which is used to build the message.
        Returns:
        The StringBuilder which is used to build the message.
      • send

        java.util.concurrent.CompletableFuture<Message> send​(User user)
        Sends the message.
        Parameters:
        user - The user to which the message should be sent.
        Returns:
        The sent message.
      • send

        java.util.concurrent.CompletableFuture<Message> send​(TextChannel channel)
        Sends the message.
        Parameters:
        channel - The channel in which the message should be sent.
        Returns:
        The sent message.
      • send

        java.util.concurrent.CompletableFuture<Message> send​(IncomingWebhook webhook)
        Sends the message.
        Parameters:
        webhook - The webhook from which the message should be sent.
        Returns:
        The sent message.
      • send

        java.util.concurrent.CompletableFuture<Message> send​(Messageable messageable)
        Sends the message.
        Parameters:
        messageable - The receiver of the message.
        Returns:
        The sent message.
      • edit

        java.util.concurrent.CompletableFuture<Message> edit​(Message message,
                                                             boolean allFields)
        Edits the message.
        Parameters:
        message - The message to edit.
        allFields - True if all fields should be included in the patch request, even if not changed; False if only changed fields should be patched
        Returns:
        The edited message.
      • sendWithWebhook

        java.util.concurrent.CompletableFuture<Message> sendWithWebhook​(DiscordApi api,
                                                                        java.lang.String webhookId,
                                                                        java.lang.String webhookToken)
        Sends the message.
        Parameters:
        api - The api instance needed to send and return the message.
        webhookId - The id of the webhook from which the message should be sent.
        webhookToken - The token of the webhook from which the message should be sent.
        Returns:
        The sent message.