public final class Webhook extends Object implements Entity
Constructor and Description |
---|
Webhook(GatewayDiscordClient gateway,
discord4j.discordjson.json.WebhookData data)
Constructs a
Webhook with an associated ServiceMediator and Discord data. |
Modifier and Type | Method and Description |
---|---|
Mono<Void> |
delete()
Requests to delete this webhook.
|
Mono<Void> |
delete(String reason)
Requests to delete this webhook while optionally specifying a reason.
|
Mono<Webhook> |
edit(Consumer<? super WebhookEditSpec> spec)
Requests to edit this webhook.
|
boolean |
equals(Object obj) |
Optional<Snowflake> |
getApplicationId()
Gets the bot/OAuth2 application ID that created this webhook.
|
Optional<String> |
getAvatar()
Gets the avatar of this webhook, if present.
|
Mono<GuildMessageChannel> |
getChannel()
Requests to retrieve the channel this webhook is associated to.
|
Mono<GuildMessageChannel> |
getChannel(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the channel this webhook is associated to, using the given retrieval strategy.
|
Snowflake |
getChannelId()
Gets the ID of the channel this webhook is associated to.
|
GatewayDiscordClient |
getClient()
Returns the
GatewayDiscordClient that created this object. |
Mono<User> |
getCreator()
Requests to retrieve the user this webhook was created by, if present.
|
Mono<User> |
getCreator(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the user this webhook was created by, if present, using the given retrieval strategy.
|
Snowflake |
getCreatorId()
Gets the ID of the user this webhook was created by.
|
Mono<Guild> |
getGuild()
Requests to retrieve the guild this webhook is associated to.
|
Mono<Guild> |
getGuild(EntityRetrievalStrategy retrievalStrategy)
Requests to retrieve the guild this webhook is associated to, using the given retrieval strategy.
|
Snowflake |
getGuildId()
Gets the ID of the guild this webhook is associated to.
|
Snowflake |
getId()
Gets the Snowflake that uniquely identifies this entity.
|
Optional<String> |
getName()
Gets the default name of the webhook.
|
String |
getToken()
Gets the secure token of this webhook.
|
int |
hashCode() |
String |
toString() |
public Webhook(GatewayDiscordClient gateway, discord4j.discordjson.json.WebhookData data)
Webhook
with an associated ServiceMediator and Discord data.gateway
- The GatewayDiscordClient
associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.public GatewayDiscordClient getClient()
DiscordObject
GatewayDiscordClient
that created this object. Methods in it are exclusively based on the
entity cache or Store
in use. Refer to calling getClient().rest()
to access a
DiscordClient
that is capable of requesting entities directly from the REST API.getClient
in interface DiscordObject
GatewayDiscordClient
associated to this object.public Snowflake getId()
Entity
public Snowflake getGuildId()
public Mono<Guild> getGuild()
public Mono<Guild> getGuild(EntityRetrievalStrategy retrievalStrategy)
public Snowflake getChannelId()
public Mono<GuildMessageChannel> getChannel()
public Mono<GuildMessageChannel> getChannel(EntityRetrievalStrategy retrievalStrategy)
public Snowflake getCreatorId()
public Mono<User> getCreator()
public Mono<User> getCreator(EntityRetrievalStrategy retrievalStrategy)
public Optional<String> getName()
public Optional<String> getAvatar()
public String getToken()
public Optional<Snowflake> getApplicationId()
public Mono<Void> delete()
Mono
where, upon successful completion, emits nothing; indicating the webhook has been deleted.
If an error is received, it is emitted through the Mono
.public Mono<Void> delete(@Nullable String reason)
reason
- The reason, if present.Mono
where, upon successful completion, emits nothing; indicating the webhook has been deleted.
If an error is received, it is emitted through the Mono
.public Mono<Webhook> edit(Consumer<? super WebhookEditSpec> spec)
spec
- A Consumer
that provides a "blank" WebhookEditSpec
to be operated on.Mono
where, upon successful completion, emits the edited Guild
. If an error is
received, it is emitted through the Mono
.