Class RestWebhook

java.lang.Object
discord4j.rest.entity.RestWebhook

public class RestWebhook extends Object
Represents a webhook entity in Discord. Webhooks are a low-effort way to post messages to channels in Discord.
  • Method Details

    • create

      public static RestWebhook create(RestClient restClient, Snowflake id)
      Create a RestWebhook for a given ID. This method does not perform any API request.
      Parameters:
      restClient - the client to make API requests
      id - the ID of this entity
      Returns:
      a RestWebhook represented by this id.
    • getId

      public Snowflake getId()
      Returns the ID of this webhook.
      Returns:
      The ID of this webhook
    • getData

      public Mono<discord4j.discordjson.json.WebhookData> getData()
      Retrieve this webhook's data upon subscription.
      Returns:
      a Mono where, upon successful completion, emits the WebhookData belonging to this entity. If an error is received, it is emitted through the Mono.
    • modify

      public Mono<discord4j.discordjson.json.WebhookData> modify(discord4j.discordjson.json.WebhookModifyRequest request, @Nullable String reason)
      Modify a webhook. Requires the Permission.MANAGE_WEBHOOKS permission. Returns the updated webhook object on success.
      Parameters:
      request - a request to modify the webhook
      reason - an optional reason for the audit log
      Returns:
      a Mono where, upon subscription, emits the updated WebhookData on success. If an error is received, it is emitted through the Mono.
    • delete

      public Mono<Void> delete(@Nullable String reason)
      Delete a webhook permanently. Requires the Permission.MANAGE_WEBHOOKS permission. Returns empty on success.
      Parameters:
      reason - an optional reason for the audit log
      Returns:
      a Mono where, upon subscription, emits a complete signal on success. If an error is received, it is emitted through the Mono.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object