Package org.javacord.api.entity.webhook
Class WebhookBuilder
- java.lang.Object
-
- org.javacord.api.entity.webhook.WebhookBuilder
-
public class WebhookBuilder extends Object
This class can be used to create webhooks.
-
-
Constructor Summary
Constructors Constructor Description WebhookBuilder(ServerTextChannel channel)Creates a new webhook builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<IncomingWebhook>create()Creates the webhook.WebhookBuildersetAuditLogReason(String reason)Sets the reason for this update.WebhookBuildersetAvatar(byte[] avatar)Sets the avatar.WebhookBuildersetAvatar(byte[] avatar, String fileType)Sets the avatar.WebhookBuildersetAvatar(BufferedImage avatar)Sets the avatar.WebhookBuildersetAvatar(BufferedImage avatar, String fileType)Sets the avatar.WebhookBuildersetAvatar(File avatar)Sets the avatar.WebhookBuildersetAvatar(InputStream avatar)Sets the avatar.WebhookBuildersetAvatar(InputStream avatar, String fileType)Sets the avatar.WebhookBuildersetAvatar(URL avatar)Sets the avatar.WebhookBuildersetAvatar(Icon avatar)Sets the avatar.WebhookBuildersetName(String name)Sets the name.
-
-
-
Constructor Detail
-
WebhookBuilder
public WebhookBuilder(ServerTextChannel channel)
Creates a new webhook builder.- Parameters:
channel- The server text channel of the webhook.
-
-
Method Detail
-
setAuditLogReason
public WebhookBuilder setAuditLogReason(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 WebhookBuilder setName(String name)
Sets the name.- Parameters:
name- The new name of the webhook.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookBuilder setAvatar(BufferedImage avatar)
Sets the avatar. 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 WebhookBuilder setAvatar(BufferedImage avatar, String fileType)
Sets the avatar.- 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 WebhookBuilder setAvatar(File avatar)
Sets the avatar.- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookBuilder setAvatar(Icon avatar)
Sets the avatar.- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookBuilder setAvatar(URL avatar)
Sets the avatar.- Parameters:
avatar- The avatar to set.- Returns:
- The current instance in order to chain call methods.
-
setAvatar
public WebhookBuilder setAvatar(byte[] avatar)
Sets the avatar. 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 WebhookBuilder setAvatar(byte[] avatar, String fileType)
Sets the avatar.- 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 WebhookBuilder setAvatar(InputStream avatar)
Sets the avatar. 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 WebhookBuilder setAvatar(InputStream avatar, String fileType)
Sets the avatar.- 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.
-
create
public CompletableFuture<IncomingWebhook> create()
Creates the webhook.- Returns:
- The created webhook.
-
-