Interface WebhookClient<T>

    • Method Detail

      • sendMessage

        @Nonnull
        @CheckReturnValue
        WebhookMessageAction<T> sendMessage​(@Nonnull
                                            java.lang.String content)
        Send a message to this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        Parameters:
        content - The message content
        Returns:
        WebhookMessageAction
        Throws:
        java.lang.IllegalArgumentException - If the content is null, empty, or longer than Message.MAX_CONTENT_LENGTH
      • sendMessage

        @Nonnull
        @CheckReturnValue
        WebhookMessageAction<T> sendMessage​(@Nonnull
                                            Message message)
        Send a message to this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        Parameters:
        message - The message to send
        Returns:
        WebhookMessageAction
        Throws:
        java.lang.IllegalArgumentException - If the message is null
      • sendMessageFormat

        @Nonnull
        @CheckReturnValue
        default WebhookMessageAction<T> sendMessageFormat​(@Nonnull
                                                          java.lang.String format,
                                                          @Nonnull
                                                          java.lang.Object... args)
        Send a message to this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        Parameters:
        format - Format string for the message content
        args - Format arguments for the content
        Returns:
        WebhookMessageAction
        Throws:
        java.lang.IllegalArgumentException - If the format string is null or the resulting content is longer than Message.MAX_CONTENT_LENGTH
      • sendFile

        @Nonnull
        @CheckReturnValue
        WebhookMessageAction<T> sendFile​(@Nonnull
                                         java.io.InputStream data,
                                         @Nonnull
                                         java.lang.String name,
                                         @Nonnull
                                         AttachmentOption... options)
        Send a message to this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         InputStream file = new FileInputStream("image.png"); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.sendFile(file, "cat.png").addEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        Parameters:
        data - The InputStream data to upload to the webhook.
        name - The file name that should be sent to discord
        Refer to the documentation for sendFile(java.io.File, String, AttachmentOption...) for information about this parameter.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageAction
        Throws:
        java.lang.IllegalArgumentException - If the provided file or filename is null or empty.
      • sendFile

        @Nonnull
        @CheckReturnValue
        default WebhookMessageAction<T> sendFile​(@Nonnull
                                                 java.io.File file,
                                                 @Nonnull
                                                 AttachmentOption... options)
        Send a message to this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        This is a shortcut to sendFile(java.io.File, String, AttachmentOption...) by way of using File.getName().

        sendFile(file, file.getName())

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         File data = new File("image.png"); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.sendFile(file, "cat.png").addEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        Parameters:
        file - The File data to upload to the webhook.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageAction
        Throws:
        java.lang.IllegalArgumentException - If the provided file is null.
      • sendFile

        @Nonnull
        @CheckReturnValue
        default WebhookMessageAction<T> sendFile​(@Nonnull
                                                 java.io.File file,
                                                 @Nonnull
                                                 java.lang.String name,
                                                 @Nonnull
                                                 AttachmentOption... options)
        Send a message to this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        The name parameter is used to inform Discord about what the file should be called. This is 2 fold:

        1. The file name provided is the name that is found in Message.Attachment.getFileName() after upload and it is the name that will show up in the client when the upload is displayed.
          Note: The fileName does not show up on the Desktop client for images. It does on mobile however.
        2. The extension of the provided fileName also determines how Discord will treat the file. Discord currently only has special handling for image file types, but the fileName's extension must indicate that it is an image file. This means it has to end in something like .png, .jpg, .jpeg, .gif, etc. As a note, you can also not provide a full name for the file and instead ONLY provide the extension like "png" or "gif" and Discord will generate a name for the upload and append the fileName as the extension.

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         byte[] data = IOUtils.readAllBytes(new FileInputStream("image.png")); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.sendFile(file, "cat.png").addEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        Parameters:
        file - The File data to upload to the webhook.
        name - The file name that should be sent to discord
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageAction
        Throws:
        java.lang.IllegalArgumentException - If the provided file or filename is null or empty.
      • sendFile

        @Nonnull
        @CheckReturnValue
        default WebhookMessageAction<T> sendFile​(@Nonnull
                                                 byte[] data,
                                                 @Nonnull
                                                 java.lang.String name,
                                                 @Nonnull
                                                 AttachmentOption... options)
        Send a message to this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         byte[] data = IOUtils.readAllBytes(new FileInputStream("image.png")); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.sendFile(file, "cat.png").addEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        Parameters:
        data - The byte[] data to upload to the webhook.
        name - The file name that should be sent to discord
        Refer to the documentation for sendFile(java.io.File, String, AttachmentOption...) for information about this parameter.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageAction
        Throws:
        java.lang.IllegalArgumentException - If the provided file or filename is null or empty.
      • editMessageById

        @Nonnull
        @CheckReturnValue
        WebhookMessageUpdateAction<T> editMessageById​(@Nonnull
                                                      java.lang.String messageId,
                                                      @Nonnull
                                                      java.lang.String content)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        content - The new message content to use
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided content is null, empty, or longer than Message.MAX_CONTENT_LENGTH
      • editMessageById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageById​(long messageId,
                                                              @Nonnull
                                                              java.lang.String content)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        content - The new message content to use
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided content is null, empty, or longer than Message.MAX_CONTENT_LENGTH
      • editMessageById

        @Nonnull
        @CheckReturnValue
        WebhookMessageUpdateAction<T> editMessageById​(@Nonnull
                                                      java.lang.String messageId,
                                                      @Nonnull
                                                      Message message)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        message - The new message to replace the existing message with
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided message is null
      • editMessageById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageById​(long messageId,
                                                              Message message)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        message - The new message to replace the existing message with
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided message is null
      • editMessageFormatById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageFormatById​(@Nonnull
                                                                    java.lang.String messageId,
                                                                    @Nonnull
                                                                    java.lang.String format,
                                                                    @Nonnull
                                                                    java.lang.Object... args)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        format - Format string for the message content
        args - Format arguments for the content
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the formatted string is null, empty, or longer than Message.MAX_CONTENT_LENGTH
      • editMessageFormatById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageFormatById​(long messageId,
                                                                    @Nonnull
                                                                    java.lang.String format,
                                                                    @Nonnull
                                                                    java.lang.Object... args)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        format - Format string for the message content
        args - Format arguments for the content
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the formatted string is null, empty, or longer than Message.MAX_CONTENT_LENGTH
      • editMessageEmbedsById

        @Nonnull
        @CheckReturnValue
        WebhookMessageUpdateAction<T> editMessageEmbedsById​(@Nonnull
                                                            java.lang.String messageId,
                                                            @Nonnull
                                                            java.util.Collection<? extends MessageEmbed> embeds)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        embeds - MessageEmbeds to use (up to 10 in total)
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided embeds are null, or more than 10
      • editMessageEmbedsById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageEmbedsById​(long messageId,
                                                                    @Nonnull
                                                                    java.util.Collection<? extends MessageEmbed> embeds)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        embeds - MessageEmbeds to use (up to 10 in total)
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided embeds are null, or more than 10
      • editMessageEmbedsById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageEmbedsById​(@Nonnull
                                                                    java.lang.String messageId,
                                                                    @Nonnull
                                                                    MessageEmbed... embeds)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        embeds - The new MessageEmbeds to use
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided embeds are null, or more than 10
      • editMessageEmbedsById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageEmbedsById​(long messageId,
                                                                    @Nonnull
                                                                    MessageEmbed... embeds)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        embeds - The new MessageEmbeds to use
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided embeds are null, or more than 10
      • editMessageComponentsById

        @Nonnull
        @CheckReturnValue
        WebhookMessageUpdateAction<T> editMessageComponentsById​(@Nonnull
                                                                java.lang.String messageId,
                                                                @Nonnull
                                                                java.util.Collection<? extends ComponentLayout> components)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        components - The new component layouts for this message, such as ActionRows
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided components are null, or more than 5 layouts are provided
      • editMessageComponentsById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageComponentsById​(long messageId,
                                                                        @Nonnull
                                                                        java.util.Collection<? extends ComponentLayout> components)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        components - The new component layouts for this message, such as ActionRows
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided components are null, or more than 5 layouts are provided
      • editMessageComponentsById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageComponentsById​(@Nonnull
                                                                        java.lang.String messageId,
                                                                        @Nonnull
                                                                        ComponentLayout... components)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        components - The new component layouts for this message, such as ActionRows
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided components are null, or more than 5 layouts are provided
      • editMessageComponentsById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageComponentsById​(long messageId,
                                                                        @Nonnull
                                                                        ComponentLayout... components)
        Edit an existing message sent by this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        components - The new component layouts for this message, such as ActionRows
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided components are null, or more than 5 layouts are provided
      • editMessageById

        @Nonnull
        @CheckReturnValue
        WebhookMessageUpdateAction<T> editMessageById​(@Nonnull
                                                      java.lang.String messageId,
                                                      @Nonnull
                                                      java.io.InputStream data,
                                                      @Nonnull
                                                      java.lang.String name,
                                                      @Nonnull
                                                      AttachmentOption... options)
        Edit an existing message sent by this webhook.
        The provided file will be appended to the message. You cannot delete or edit existing files on a message.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         InputStream file = new FileInputStream("image.png"); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        data - The InputStream data to upload to the webhook.
        name - The file name that should be sent to discord
        Refer to the documentation for sendFile(java.io.File, String, AttachmentOption...) for information about this parameter.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided message id, data, or filename is null.
      • editMessageById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageById​(@Nonnull
                                                              java.lang.String messageId,
                                                              @Nonnull
                                                              java.io.File file,
                                                              @Nonnull
                                                              AttachmentOption... options)
        Edit an existing message sent by this webhook.
        The provided file will be appended to the message. You cannot delete or edit existing files on a message.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        This is a shortcut to editMessageById(java.lang.String, java.io.File, String, AttachmentOption...) by way of using File.getName().

        editMessageById(messageId, file, file.getName())

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         File file = new File("image.png"); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        file - The File data to upload to the webhook.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided message id or file is null.
      • editMessageById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageById​(@Nonnull
                                                              java.lang.String messageId,
                                                              @Nonnull
                                                              java.io.File file,
                                                              @Nonnull
                                                              java.lang.String name,
                                                              @Nonnull
                                                              AttachmentOption... options)
        Edit an existing message sent by this webhook.
        The provided file will be appended to the message. You cannot delete or edit existing files on a message.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         File file = new File("image.png"); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        file - The File data to upload to the webhook.
        name - The file name that should be sent to discord
        Refer to the documentation for sendFile(java.io.File, String, AttachmentOption...) for information about this parameter.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided file, message id, or filename is null.
      • editMessageById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageById​(@Nonnull
                                                              java.lang.String messageId,
                                                              @Nonnull
                                                              byte[] data,
                                                              @Nonnull
                                                              java.lang.String name,
                                                              @Nonnull
                                                              AttachmentOption... options)
        Edit an existing message sent by this webhook.
        The provided file will be appended to the message. You cannot delete or edit existing files on a message.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         InputStream file = new FileInputStream("image.png"); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        data - The InputStream data to upload to the webhook.
        name - The file name that should be sent to discord
        Refer to the documentation for sendFile(java.io.File, String, AttachmentOption...) for information about this parameter.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided message id, data, or filename is null.
      • editMessageById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageById​(long messageId,
                                                              @Nonnull
                                                              java.io.InputStream data,
                                                              @Nonnull
                                                              java.lang.String name,
                                                              @Nonnull
                                                              AttachmentOption... options)
        Edit an existing message sent by this webhook.
        The provided file will be appended to the message. You cannot delete or edit existing files on a message.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         InputStream file = new FileInputStream("image.png"); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        data - The InputStream data to upload to the webhook.
        name - The file name that should be sent to discord
        Refer to the documentation for sendFile(java.io.File, String, AttachmentOption...) for information about this parameter.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided data or filename is null.
      • editMessageById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageById​(long messageId,
                                                              @Nonnull
                                                              java.io.File file,
                                                              @Nonnull
                                                              AttachmentOption... options)
        Edit an existing message sent by this webhook.
        The provided file will be appended to the message. You cannot delete or edit existing files on a message.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        This is a shortcut to sendFile(java.io.File, String, AttachmentOption...) by way of using File.getName().

        sendFile(file, file.getName())

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         File file = new File("image.png"); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        file - The File data to upload to the webhook.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided file is null.
      • editMessageById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageById​(long messageId,
                                                              @Nonnull
                                                              java.io.File file,
                                                              @Nonnull
                                                              java.lang.String name,
                                                              @Nonnull
                                                              AttachmentOption... options)
        Edit an existing message sent by this webhook.
        The provided file will be appended to the message. You cannot delete or edit existing files on a message.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         File file = new File("image.png"); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        file - The File data to upload to the webhook.
        name - The file name that should be sent to discord
        Refer to the documentation for sendFile(java.io.File, String, AttachmentOption...) for information about this parameter.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided file or filename is null.
      • editMessageById

        @Nonnull
        @CheckReturnValue
        default WebhookMessageUpdateAction<T> editMessageById​(long messageId,
                                                              @Nonnull
                                                              byte[] data,
                                                              @Nonnull
                                                              java.lang.String name,
                                                              @Nonnull
                                                              AttachmentOption... options)
        Edit an existing message sent by this webhook.
        The provided file will be appended to the message. You cannot delete or edit existing files on a message.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Uploading images with Embeds
        When uploading an image you can reference said image using the specified filename as URI attachment://filename.ext.

        Example

        
         WebhookClient hook; // = reference of a WebhookClient such as interaction.getHook()
         EmbedBuilder embed = new EmbedBuilder();
         InputStream file = new FileInputStream("image.png"); // the name in your file system can be different from the name used in discord
         embed.setImage("attachment://cat.png") // we specify this in sendFile as "cat.png"
              .setDescription("This is a cute cat :3");
         hook.editMessageById(messageId, file, "cat.png").setEmbeds(embed.build()).queue();
         

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The message id. For interactions this supports "@original" to edit the source message of the interaction.
        data - The InputStream data to upload to the webhook.
        name - The file name that should be sent to discord
        Refer to the documentation for sendFile(java.io.File, String, AttachmentOption...) for information about this parameter.
        options - Possible options to apply to this attachment, such as marking it as spoiler image
        Returns:
        WebhookMessageUpdateAction
        Throws:
        java.lang.IllegalArgumentException - If the provided data or filename is null.
      • deleteMessageById

        @Nonnull
        @CheckReturnValue
        RestAction<java.lang.Void> deleteMessageById​(@Nonnull
                                                     java.lang.String messageId)
        Delete a message from this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The id for the message to delete
        Returns:
        RestAction
        Throws:
        java.lang.IllegalArgumentException - If the provided message id is null or not a valid snowflake
      • deleteMessageById

        @Nonnull
        @CheckReturnValue
        default RestAction<java.lang.Void> deleteMessageById​(long messageId)
        Delete a message from this webhook.

        If this is an InteractionHook this method will be delayed until the interaction is acknowledged.

        Possible ErrorResponses include:

        • UNKNOWN_WEBHOOK
          The webhook is no longer available, either it was deleted or in case of interactions it expired.
        • UNKNOWN_MESSAGE
          The message for that id does not exist
        Parameters:
        messageId - The id for the message to delete
        Returns:
        RestAction