Package org.javacord.api.entity.webhook
Interface IncomingWebhook
-
- All Superinterfaces:
Deletable,DiscordEntity,Messageable,Updatable<Webhook>,Webhook,WebhookAttachableListenerManager
public interface IncomingWebhook extends Webhook, Messageable
This class represents a webhook you can send messages to.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.concurrent.CompletableFuture<Webhook>getLatestInstance()Gets an updated instance of this entity from the cache or from Discord directly.default java.util.concurrent.CompletableFuture<IncomingWebhook>getLatestInstanceAsIncomingWebhook()Gets an updated instance of this entity from Discord directly.java.lang.StringgetToken()Gets the secure token of the webhook.default java.net.URLgetUrl()Gets the secure url of the webhook.default booleanisChannelFollowerWebhook()Checks if the webhook is a channel follower webhook.default booleanisIncomingWebhook()Checks if the webhook is an incoming webhook.default java.util.concurrent.CompletableFuture<Message>sendMessage(java.lang.String content, java.lang.String displayName, java.net.URL avatarUrl)Sends a message.default java.util.concurrent.CompletableFuture<Message>sendMessage(java.lang.String content, java.lang.String displayName, Icon avatar)Sends a message.default java.util.concurrent.CompletableFuture<Message>sendMessage(java.lang.String content, EmbedBuilder... embeds)Sends a message.default java.util.concurrent.CompletableFuture<Message>sendMessage(java.lang.String content, EmbedBuilder embed, java.lang.String displayName, java.net.URL avatarUrl)Sends a message.default java.util.concurrent.CompletableFuture<Message>sendMessage(java.lang.String content, EmbedBuilder embed, java.lang.String displayName, Icon avatar)Sends a message.default java.util.concurrent.CompletableFuture<Message>sendMessage(EmbedBuilder... embeds)Sends a message.default java.util.concurrent.CompletableFuture<Message>sendMessage(EmbedBuilder embed, java.lang.String displayName, java.net.URL avatarUrl)Sends a message.default java.util.concurrent.CompletableFuture<Message>sendMessage(EmbedBuilder embed, java.lang.String displayName, Icon avatar)Sends a message.-
Methods inherited from interface org.javacord.api.entity.Deletable
delete, delete, deleteAfter, deleteAfter, deleteAfter, deleteAfter, getApi
-
Methods inherited from interface org.javacord.api.entity.DiscordEntity
getApi, getCreationTimestamp, getId, getIdAsString
-
Methods inherited from interface org.javacord.api.entity.message.Messageable
sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage, sendMessage
-
Methods inherited from interface org.javacord.api.entity.webhook.Webhook
asIncomingWebhook, createUpdater, getAvatar, getChannel, getChannelId, getCreator, getName, getServer, getServerId, getType, removeAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateChannel, updateName
-
Methods inherited from interface org.javacord.api.listener.webhook.WebhookAttachableListenerManager
addMessageCreateListener, addMessageReplyListener, addWebhookAttachableListener, getMessageCreateListeners, getMessageReplyListeners, getWebhookAttachableListeners, removeListener, removeWebhookAttachableListener
-
-
-
-
Method Detail
-
isIncomingWebhook
default boolean isIncomingWebhook()
Description copied from interface:WebhookChecks if the webhook is an incoming webhook.- Specified by:
isIncomingWebhookin interfaceWebhook- Returns:
- Whether the webhook an incoming webhook.
-
isChannelFollowerWebhook
default boolean isChannelFollowerWebhook()
Description copied from interface:WebhookChecks if the webhook is a channel follower webhook.- Specified by:
isChannelFollowerWebhookin interfaceWebhook- Returns:
- Whether the webhook a channel following webhook.
-
getToken
java.lang.String getToken()
Gets the secure token of the webhook.- Returns:
- The secure token of the webhook.
-
getUrl
default java.net.URL getUrl()
Gets the secure url of the webhook.- Returns:
- The secure url of the webhook.
-
getLatestInstance
default java.util.concurrent.CompletableFuture<Webhook> getLatestInstance()
Description copied from interface:UpdatableGets an updated instance of this entity from the cache or from Discord directly. This is for example necessary if an instance got invalid by a reconnect to Discord which invalidates all existing instances which means they do not get any further updates from Discord applied. Due to that, references to instances should usually not be held for an extended period of time. If they are, this method can be used to retrieve the current instance from the cache if present or from Discord directly.This method returns the currently cached entity if present, or request the entity from Discord if it is not cached or not permanently cached. If the entity is a fully cached entity and is not in the cache any longer, for example because it was deleted or the message was thrown out of the cache, the
CompletableFuturecompletes exceptionally with aNoSuchElementException. If a request to Discord is made, the according remote call exception will be used to complete theCompletableFutureexceptionally.- Specified by:
getLatestInstancein interfaceUpdatable<Webhook>- Specified by:
getLatestInstancein interfaceWebhook- Returns:
- The current cached instance.
-
getLatestInstanceAsIncomingWebhook
default java.util.concurrent.CompletableFuture<IncomingWebhook> getLatestInstanceAsIncomingWebhook()
Gets an updated instance of this entity from Discord directly.- Returns:
- The current instance.
- See Also:
getLatestInstance()
-
sendMessage
default java.util.concurrent.CompletableFuture<Message> sendMessage(EmbedBuilder... embeds)
Sends a message.- Specified by:
sendMessagein interfaceMessageable- Parameters:
embeds- The embeds which should be displayed.- Returns:
- The sent message.
-
sendMessage
default java.util.concurrent.CompletableFuture<Message> sendMessage(java.lang.String content, EmbedBuilder... embeds)
Sends a message.- Specified by:
sendMessagein interfaceMessageable- Parameters:
content- The content of the message.embeds- The embeds which should be displayed.- Returns:
- The sent message.
-
sendMessage
default java.util.concurrent.CompletableFuture<Message> sendMessage(java.lang.String content, EmbedBuilder embed, java.lang.String displayName, java.net.URL avatarUrl)
Sends a message.- Parameters:
content- The content of the message.displayName- The name which should be used by the webhook.avatarUrl- The avatar which should be used by the webhook.embed- The embed which should be displayed.- Returns:
- The sent message.
-
sendMessage
default java.util.concurrent.CompletableFuture<Message> sendMessage(java.lang.String content, EmbedBuilder embed, java.lang.String displayName, Icon avatar)
Sends a message.- Parameters:
content- The content of the message.displayName- The name which should be used by the webhook.avatar- The avatar which should be used by the webhook.embed- The embed which should be displayed.- Returns:
- The sent message.
-
sendMessage
default java.util.concurrent.CompletableFuture<Message> sendMessage(java.lang.String content, java.lang.String displayName, java.net.URL avatarUrl)
Sends a message.- Parameters:
content- The content of the message.displayName- The name which should be used by the webhook.avatarUrl- The avatar which should be used by the webhook.- Returns:
- The sent message.
-
sendMessage
default java.util.concurrent.CompletableFuture<Message> sendMessage(java.lang.String content, java.lang.String displayName, Icon avatar)
Sends a message.- Parameters:
content- The content of the message.displayName- The name which should be used by the webhook.avatar- The avatar which should be used by the webhook.- Returns:
- The sent message.
-
sendMessage
default java.util.concurrent.CompletableFuture<Message> sendMessage(EmbedBuilder embed, java.lang.String displayName, java.net.URL avatarUrl)
Sends a message.- Parameters:
embed- The embed which should be displayed.displayName- The name which should be used by the webhook.avatarUrl- The avatar which should be used by the webhook.- Returns:
- The sent message.
-
sendMessage
default java.util.concurrent.CompletableFuture<Message> sendMessage(EmbedBuilder embed, java.lang.String displayName, Icon avatar)
Sends a message.- Parameters:
embed- The embed which should be displayed.displayName- The name which should be used by the webhook.avatar- The avatar which should be used by the webhook.- Returns:
- The sent message.
-
-