Package discord4j.rest.entity
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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RestWebhookcreate(RestClient restClient, Snowflake id)Create aRestWebhookfor a given ID.Mono<Void>delete(String reason)Delete a webhook permanently.booleanequals(Object o)Mono<discord4j.discordjson.json.WebhookData>getData()Retrieve this webhook's data upon subscription.SnowflakegetId()Returns the ID of this webhook.inthashCode()Mono<discord4j.discordjson.json.WebhookData>modify(discord4j.discordjson.json.WebhookModifyRequest request, String reason)Modify a webhook.
-
-
-
Method Detail
-
create
public static RestWebhook create(RestClient restClient, Snowflake id)
Create aRestWebhookfor a given ID. This method does not perform any API request.- Parameters:
restClient- the client to make API requestsid- the ID of this entity- Returns:
- a
RestWebhookrepresented by thisid.
-
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
Monowhere, upon successful completion, emits theWebhookDatabelonging to this entity. If an error is received, it is emitted through theMono.
-
modify
public Mono<discord4j.discordjson.json.WebhookData> modify(discord4j.discordjson.json.WebhookModifyRequest request, @Nullable String reason)
Modify a webhook. Requires thePermission.MANAGE_WEBHOOKSpermission. Returns the updated webhook object on success.- Parameters:
request- a request to modify the webhookreason- an optional reason for the audit log- Returns:
- a
Monowhere, upon subscription, emits the updatedWebhookDataon success. If an error is received, it is emitted through theMono.
-
delete
public Mono<Void> delete(@Nullable String reason)
Delete a webhook permanently. Requires thePermission.MANAGE_WEBHOOKSpermission. Returns empty on success.- Parameters:
reason- an optional reason for the audit log- Returns:
- a
Monowhere, upon subscription, emits a complete signal on success. If an error is received, it is emitted through theMono.
-
-