Interface Webhook

    • Method Detail

      • getJDA

        JDA getJDA()
        The JDA instance of this Webhook.
        Returns:
        The current JDA instance of this Webhook
      • getGuild

        Guild getGuild()
        The Guild instance for this Webhook.
        This is a shortcut for getChannel().getGuild().
        Returns:
        The current Guild of this Webhook
      • getChannel

        TextChannel getChannel()
        The TextChannel instance this Webhook is attached to.
        Returns:
        The current TextChannel of this Webhook
      • getOwner

        @Nullable
        Member getOwner()
        The owner of this Webhook. This will be null for fake Webhooks, such as those retrieved from Audit Logs.
        Returns:
        Possibly-null Member instance representing the owner of this Webhook.
      • getDefaultUser

        User getDefaultUser()
        The default User for this Webhook.

        The User returned is always fake.
        This User is used for all messages posted to the Webhook route (found in getUrl()), it holds the default references for the message authors of messages by this Webhook.

        When POSTing to a Webhook route the name/avatar of this default user can be overridden.

        Returns:
        A fake User instance representing the default webhook user.
        See Also:
        Execute Webhook Docs
      • getName

        java.lang.String getName()
        The name of this Webhook.
        This will be displayed by default as the author name of every message by this Webhook.

        This is a shortcut for getDefaultUser().getName().

        Returns:
        The name of this Webhook
      • getToken

        @Nullable
        java.lang.String getToken()
        The execute token for this Webhook.
        This can be used to modify/delete/execute this Webhook.

        Note: Fake Webhooks, such as those retrieved from Audit Logs, do not contain a token

        Returns:
        The execute token for this Webhook
      • getUrl

        java.lang.String getUrl()
        The POST route for this Webhook.
        This contains the token and id of this Webhook. Fake Webhooks without tokens (such as those retrieved from Audit Logs) will return a URL without a token.

        The route returned by this method does not need permission checks to be executed.
        It is implied that Webhook messages always have all permissions including mentioning everyone.

        Webhook executions are limited with 5 requests per second. The response contains rate limit headers that should be handled by execution frameworks. (Learn More)

        Returns:
        The execution route for this Webhook.
      • delete

        @CheckReturnValue
        AuditableRestAction<java.lang.Void> delete()
        Deletes this Webhook.
        Returns:
        AuditableRestAction
        The rest action to delete this Webhook.
        Throws:
        java.lang.IllegalStateException - if the Webhook is fake, such as the Webhooks retrieved from Audit Logs
      • newClient

        WebhookClientBuilder newClient()
        Creates a new WebhookClientBuilder instance for this Webhook instance.

        Remember to close the WebhookClient once you don't need it anymore to free resources!

        Returns:
        The new WebhookClientBuilder
        Throws:
        java.lang.IllegalStateException - if the Webhook is fake, such as the Webhooks retrieved from Audit Logs