Package discord4j.core.object.entity
Class Webhook
- java.lang.Object
-
- discord4j.core.object.entity.Webhook
-
- All Implemented Interfaces:
DiscordObject
,Entity
public final class Webhook extends Object implements Entity
A Discord webhook.- See Also:
- Webhook Resource
-
-
Constructor Summary
Constructors Constructor Description Webhook(ServiceMediator serviceMediator, WebhookBean data)
Constructs aWebhook
with an associated ServiceMediator and Discord data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description reactor.core.publisher.Mono<Void>
delete()
Requests to delete this webhook.reactor.core.publisher.Mono<Void>
delete(String reason)
Requests to delete this webhook while optionally specifying a reason.reactor.core.publisher.Mono<Webhook>
edit(Consumer<? super WebhookEditSpec> spec)
Requests to edit this webhook.boolean
equals(Object obj)
Optional<String>
getAvatar()
Gets the avatar of this webhook, if present.reactor.core.publisher.Mono<TextChannel>
getChannel()
Requests to retrieve the channel this webhook is associated to.Snowflake
getChannelId()
Gets the ID of the channel this webhook is associated to.DiscordClient
getClient()
Gets the DiscordClient associated to this object.reactor.core.publisher.Mono<User>
getCreator()
Requests to retrieve the user this webhook was created by, if present.Snowflake
getCreatorId()
Gets the ID of the user this webhook was created by.reactor.core.publisher.Mono<Guild>
getGuild()
Requests to retrieve the guild this webhook is associated to.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()
-
-
-
Constructor Detail
-
Webhook
public Webhook(ServiceMediator serviceMediator, WebhookBean data)
Constructs aWebhook
with an associated ServiceMediator and Discord data.- Parameters:
serviceMediator
- The ServiceMediator associated to this object, must be non-null.data
- The raw data as represented by Discord, must be non-null.
-
-
Method Detail
-
getClient
public DiscordClient getClient()
Description copied from interface:DiscordObject
Gets the DiscordClient associated to this object.- Specified by:
getClient
in interfaceDiscordObject
- Returns:
- The DiscordClient associated to this object.
-
getId
public Snowflake getId()
Description copied from interface:Entity
Gets the Snowflake that uniquely identifies this entity.
-
getGuildId
public Snowflake getGuildId()
Gets the ID of the guild this webhook is associated to.- Returns:
- The ID of the guild this webhook is associated to.
-
getGuild
public reactor.core.publisher.Mono<Guild> getGuild()
Requests to retrieve the guild this webhook is associated to.- Returns:
- A
Mono
where, upon successful completion, emits theguild
this webhook is associated to. If an error is received, it is emitted through theMono
.
-
getChannelId
public Snowflake getChannelId()
Gets the ID of the channel this webhook is associated to.- Returns:
- The ID of the channel this webhook is associated to.
-
getChannel
public reactor.core.publisher.Mono<TextChannel> getChannel()
Requests to retrieve the channel this webhook is associated to.- Returns:
- A
Mono
where, upon successful completion, emits thechannel
this webhook is associated to. If an error is received, it is emitted through theMono
.
-
getCreatorId
public Snowflake getCreatorId()
Gets the ID of the user this webhook was created by.- Returns:
- The ID of the user this webhook was created by.
-
getCreator
public reactor.core.publisher.Mono<User> getCreator()
Requests to retrieve the user this webhook was created by, if present.- Returns:
- A
Mono
where, upon successful completion, emits theuser
this webhook was created by, if present. If an error is received, it is emitted through theMono
.
-
getName
public Optional<String> getName()
Gets the default name of the webhook.- Returns:
- The default name of the webhook.
-
getAvatar
public Optional<String> getAvatar()
Gets the avatar of this webhook, if present.- Returns:
- The avatar of this webhook, if present.
-
getToken
public String getToken()
Gets the secure token of this webhook.- Returns:
- The secure token of this webhook.
-
delete
public reactor.core.publisher.Mono<Void> delete()
Requests to delete this webhook.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the webhook has been deleted. If an error is received, it is emitted through theMono
.
-
delete
public reactor.core.publisher.Mono<Void> delete(@Nullable String reason)
Requests to delete this webhook while optionally specifying a reason.- Parameters:
reason
- The reason, if present.- Returns:
- A
Mono
where, upon successful completion, emits nothing; indicating the webhook has been deleted. If an error is received, it is emitted through theMono
.
-
edit
public reactor.core.publisher.Mono<Webhook> edit(Consumer<? super WebhookEditSpec> spec)
Requests to edit this webhook.- Parameters:
spec
- AConsumer
that provides a "blank"WebhookEditSpec
to be operated on.- Returns:
- A
Mono
where, upon successful completion, emits the editedGuild
. If an error is received, it is emitted through theMono
.
-
-