Class WebhookBuilder


  • public class WebhookBuilder
    extends java.lang.Object
    This class can be used to create webhooks.
    • Constructor Detail

      • WebhookBuilder

        public WebhookBuilder​(ServerTextChannel channel)
        Creates a new webhook builder.
        Parameters:
        channel - The server text channel of the webhook.
    • Method Detail

      • setAuditLogReason

        public WebhookBuilder setAuditLogReason​(java.lang.String reason)
        Sets the reason for this update. This reason will be visible in the audit log entry(s).
        Parameters:
        reason - The reason for this update.
        Returns:
        The current instance in order to chain call methods.
      • setName

        public WebhookBuilder setName​(java.lang.String name)
        Sets the name.
        Parameters:
        name - The new name of the webhook.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public WebhookBuilder setAvatar​(java.awt.image.BufferedImage avatar)
        Sets the avatar. This method assumes the file type is "png"!
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public WebhookBuilder setAvatar​(java.awt.image.BufferedImage avatar,
                                        java.lang.String fileType)
        Sets the avatar.
        Parameters:
        avatar - The avatar to set.
        fileType - The type of the avatar, e.g. "png" or "jpg".
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public WebhookBuilder setAvatar​(java.io.File avatar)
        Sets the avatar.
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public WebhookBuilder setAvatar​(Icon avatar)
        Sets the avatar.
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public WebhookBuilder setAvatar​(java.net.URL avatar)
        Sets the avatar.
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public WebhookBuilder setAvatar​(byte[] avatar)
        Sets the avatar. This method assumes the file type is "png"!
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public WebhookBuilder setAvatar​(byte[] avatar,
                                        java.lang.String fileType)
        Sets the avatar.
        Parameters:
        avatar - The avatar to set.
        fileType - The type of the avatar, e.g. "png" or "jpg".
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public WebhookBuilder setAvatar​(java.io.InputStream avatar)
        Sets the avatar. This method assumes the file type is "png"!
        Parameters:
        avatar - The avatar to set.
        Returns:
        The current instance in order to chain call methods.
      • setAvatar

        public WebhookBuilder setAvatar​(java.io.InputStream avatar,
                                        java.lang.String fileType)
        Sets the avatar.
        Parameters:
        avatar - The avatar to set.
        fileType - The type of the avatar, e.g. "png" or "jpg".
        Returns:
        The current instance in order to chain call methods.
      • create

        public java.util.concurrent.CompletableFuture<IncomingWebhook> create()
        Creates the webhook.
        Returns:
        The created webhook.