Package org.javacord.api.entity.webhook
Class WebhookUpdater
- java.lang.Object
-
- org.javacord.api.entity.webhook.WebhookUpdater
-
public class WebhookUpdater extends java.lang.ObjectThis class can be used to update webhooks.
-
-
Constructor Summary
Constructors Constructor Description WebhookUpdater(Webhook webhook)Creates a new webhook updater.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WebhookUpdaterremoveAvatar()Queues the avatar to be removed.WebhookUpdatersetAuditLogReason(java.lang.String reason)Sets the reason for this update.WebhookUpdatersetAvatar(byte[] avatar)Queues the avatar to be updated.WebhookUpdatersetAvatar(byte[] avatar, java.lang.String fileType)Queues the avatar to be updated.WebhookUpdatersetAvatar(java.awt.image.BufferedImage avatar)Queues the avatar to be updated.WebhookUpdatersetAvatar(java.awt.image.BufferedImage avatar, java.lang.String fileType)Queues the avatar to be updated.WebhookUpdatersetAvatar(java.io.File avatar)Queues the avatar to be updated.WebhookUpdatersetAvatar(java.io.InputStream avatar)Queues the avatar to be updated.WebhookUpdatersetAvatar(java.io.InputStream avatar, java.lang.String fileType)Queues the avatar to be updated.WebhookUpdatersetAvatar(java.net.URL avatar)Queues the avatar to be updated.WebhookUpdatersetAvatar(Icon avatar)Queues the avatar to be updated.WebhookUpdatersetChannel(ServerTextChannel channel)Queues the channel to be updated.WebhookUpdatersetName(java.lang.String name)Queues the name to be updated.java.util.concurrent.CompletableFuture<Webhook>update()Performs the queued updates.
-
-
-
Constructor Detail
-
WebhookUpdater
public WebhookUpdater(Webhook webhook)
Creates a new webhook updater.- Parameters:
webhook- The webhook to update.
-
-
Method Detail
-
setAuditLogReason
public WebhookUpdater setAuditLogReason(java.lang.String reason)
Sets the reason for this update. This reason will be visible in the audit log entry(s).- Parameters:
reason- The reason for this update.- Returns:
- The current instance in order to chain call methods.
-
setName
public WebhookUpdater setName(java.lang.String name)
Queues the name to be updated.- Parameters:
name- The new name of the webhook.- Returns:
- The current instance in order to chain call methods.
-
setChannel
public WebhookUpdater setChannel(ServerTextChannel channel)
Queues the channel to be updated.- Parameters:
channel- The new channel of the webhook.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookUpdater setAvatar(java.awt.image.BufferedImage avatar)
Queues the avatar to be updated. This method assumes the file type is "png"!- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookUpdater setAvatar(java.awt.image.BufferedImage avatar, java.lang.String fileType)
Queues the avatar to be updated.- Parameters:
avatar- The avatar to set.fileType- The type of the avatar, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookUpdater setAvatar(java.io.File avatar)
Queues the avatar to be updated.- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookUpdater setAvatar(Icon avatar)
Queues the avatar to be updated.- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookUpdater setAvatar(java.net.URL avatar)
Queues the avatar to be updated.- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookUpdater setAvatar(byte[] avatar)
Queues the avatar to be updated. This method assumes the file type is "png"!- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookUpdater setAvatar(byte[] avatar, java.lang.String fileType)
Queues the avatar to be updated.- Parameters:
avatar- The avatar to set.fileType- The type of the avatar, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookUpdater setAvatar(java.io.InputStream avatar)
Queues the avatar to be updated. This method assumes the file type is "png"!- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookUpdater setAvatar(java.io.InputStream avatar, java.lang.String fileType)
Queues the avatar to be updated.- Parameters:
avatar- The avatar to set.fileType- The type of the avatar, e.g. "png" or "jpg".- Returns:
- The current instance in order to chain call methods.
-
removeAvatar
public WebhookUpdater removeAvatar()
Queues the avatar to be removed.- Returns:
- The current instance in order to chain call methods.
-
update
public java.util.concurrent.CompletableFuture<Webhook> update()
Performs the queued updates.- Returns:
- The updated webhook or the current instance if no updates were queued.
-
-