Package org.javacord.core.entity.webhook
Class WebhookImpl
- java.lang.Object
-
- org.javacord.core.entity.webhook.WebhookImpl
-
- All Implemented Interfaces:
Deletable
,DiscordEntity
,Updatable<Webhook>
,Webhook
,WebhookAttachableListenerManager
,Specializable<WebhookImpl>
,InternalWebhookAttachableListenerManager
- Direct Known Subclasses:
IncomingWebhookImpl
public class WebhookImpl extends java.lang.Object implements Webhook, Specializable<WebhookImpl>, InternalWebhookAttachableListenerManager
The implementation ofWebhook
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
WebhookImpl(DiscordApi api, com.fasterxml.jackson.databind.JsonNode data)
Creates a new webhook.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Optional<IncomingWebhook>
asIncomingWebhook()
static java.util.List<Webhook>
createAllIncomingWebhooksFromJsonArray(DiscordApi api, com.fasterxml.jackson.databind.JsonNode jsonArray)
Gets all the incoming webhooks that may or may not have a token from a json array.static WebhookImpl
createWebhook(DiscordApi api, com.fasterxml.jackson.databind.JsonNode data)
Creates a new webhook.java.util.concurrent.CompletableFuture<java.lang.Void>
delete(java.lang.String reason)
boolean
equals(java.lang.Object o)
DiscordApi
getApi()
Gets the discord api instance.java.util.Optional<Icon>
getAvatar()
java.util.Optional<TextChannel>
getChannel()
long
getChannelId()
java.util.Optional<User>
getCreator()
long
getId()
Gets the id of this object.java.util.Optional<java.lang.String>
getName()
java.util.Optional<Server>
getServer()
java.util.Optional<java.lang.Long>
getServerId()
WebhookType
getType()
int
hashCode()
java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.javacord.api.entity.Deletable
delete, deleteAfter, deleteAfter, deleteAfter, deleteAfter
-
Methods inherited from interface org.javacord.api.entity.DiscordEntity
getCreationTimestamp, getIdAsString
-
Methods inherited from interface org.javacord.core.listener.webhook.InternalWebhookAttachableListenerManager
addMessageCreateListener, addMessageReplyListener, addWebhookAttachableListener, getMessageCreateListeners, getMessageReplyListeners, getWebhookAttachableListeners, removeListener, removeWebhookAttachableListener
-
Methods inherited from interface org.javacord.api.util.Specializable
as
-
Methods inherited from interface org.javacord.api.entity.webhook.Webhook
createUpdater, getLatestInstance, isChannelFollowerWebhook, isIncomingWebhook, removeAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateChannel, updateName
-
-
-
-
Constructor Detail
-
WebhookImpl
protected WebhookImpl(DiscordApi api, com.fasterxml.jackson.databind.JsonNode data)
Creates a new webhook.- Parameters:
api
- The discord api instance.data
- The json data of the webhook.
-
-
Method Detail
-
createWebhook
public static WebhookImpl createWebhook(DiscordApi api, com.fasterxml.jackson.databind.JsonNode data)
Creates a new webhook.- Parameters:
api
- The discord api instance.data
- The json data of the webhook.- Returns:
- The new webhook.
-
createAllIncomingWebhooksFromJsonArray
public static java.util.List<Webhook> createAllIncomingWebhooksFromJsonArray(DiscordApi api, com.fasterxml.jackson.databind.JsonNode jsonArray)
Gets all the incoming webhooks that may or may not have a token from a json array.- Parameters:
api
- The discord api instance.jsonArray
- The json array of the webhooks.- Returns:
- All incoming webhooks from the array.
-
getApi
public DiscordApi getApi()
Description copied from interface:InternalWebhookAttachableListenerManager
Gets the discord api instance.- Specified by:
getApi
in interfaceDeletable
- Specified by:
getApi
in interfaceDiscordEntity
- Specified by:
getApi
in interfaceInternalWebhookAttachableListenerManager
- Returns:
- The discord api instance.
-
getId
public long getId()
Description copied from interface:InternalWebhookAttachableListenerManager
Gets the id of this object.- Specified by:
getId
in interfaceDiscordEntity
- Specified by:
getId
in interfaceInternalWebhookAttachableListenerManager
- Returns:
- The id of this object.
-
getServerId
public java.util.Optional<java.lang.Long> getServerId()
- Specified by:
getServerId
in interfaceWebhook
-
getServer
public java.util.Optional<Server> getServer()
-
getChannel
public java.util.Optional<TextChannel> getChannel()
- Specified by:
getChannel
in interfaceWebhook
-
getChannelId
public long getChannelId()
- Specified by:
getChannelId
in interfaceWebhook
-
getType
public WebhookType getType()
-
asIncomingWebhook
public java.util.Optional<IncomingWebhook> asIncomingWebhook()
- Specified by:
asIncomingWebhook
in interfaceWebhook
-
getCreator
public java.util.Optional<User> getCreator()
- Specified by:
getCreator
in interfaceWebhook
-
getName
public java.util.Optional<java.lang.String> getName()
-
delete
public java.util.concurrent.CompletableFuture<java.lang.Void> delete(java.lang.String reason)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-