IFakeable
, ISnowflake
public interface Webhook extends ISnowflake, IFakeable
Modifier and Type | Method | Description |
---|---|---|
AuditableRestAction<java.lang.Void> |
delete() |
Deletes this Webhook.
|
TextChannel |
getChannel() |
The
TextChannel instance
this Webhook is attached to. |
User |
getDefaultUser() |
The default User for this Webhook.
|
Guild |
getGuild() |
The
Guild instance
for this Webhook. |
JDA |
getJDA() |
The JDA instance of this Webhook.
|
WebhookManager |
getManager() |
The
WebhookManager for this Webhook. |
java.lang.String |
getName() |
The name of this Webhook.
|
Member |
getOwner() |
The owner of this Webhook.
|
java.lang.String |
getToken() |
The execute token for this Webhook.
|
java.lang.String |
getUrl() |
The
POST route for this Webhook. |
WebhookClientBuilder |
newClient() |
Creates a new
WebhookClientBuilder instance
for this Webhook instance. |
getCreationTime, getId, getIdLong
JDA getJDA()
Guild getGuild()
TextChannel getChannel()
TextChannel
instance
this Webhook is attached to.@Nullable Member getOwner()
Member
instance
representing the owner of this Webhook.User getDefaultUser()
The User
returned is always fake
.
This User is used for all messages posted to the Webhook route (found in getUrl()
),
it holds the default references for the message authors of messages by this Webhook.
When POST
ing to a Webhook route the name/avatar of this default user
can be overridden.
User
instance
representing the default webhook user.java.lang.String getName()
This is a shortcut for
.getDefaultUser()
.getName()
@Nullable java.lang.String getToken()
Note: Fake Webhooks, such as those retrieved from Audit Logs, do not contain a token
java.lang.String getUrl()
POST
route for this Webhook.
token
and id
of this Webhook. Fake Webhooks without tokens (such as those retrieved from Audit Logs)
will return a URL without a token.
The route returned by this method does not need permission checks
to be executed.
It is implied that Webhook messages always have all permissions
including mentioning everyone
.
Webhook executions are limited with 5 requests per second. The response contains rate limit headers that should be handled by execution frameworks. (Learn More)
@CheckReturnValue AuditableRestAction<java.lang.Void> delete()
AuditableRestAction
java.lang.IllegalStateException
- if the Webhook is fake, such as the Webhooks retrieved from Audit LogsWebhookManager getManager()
WebhookManager
for this Webhook.
RestAction.queue()
.WebhookManager
for this WebhookInsufficientPermissionException
- If the currently logged in account does not have Permission.MANAGE_WEBHOOKS
java.lang.IllegalStateException
- if the Webhook is fake, such as the Webhooks retrieved from Audit LogsWebhookClientBuilder newClient()
WebhookClientBuilder
instance
for this Webhook instance.
Remember to close the WebhookClient once you don't need it anymore to free resources!
java.lang.IllegalStateException
- if the Webhook is fake, such as the Webhooks retrieved from Audit Logs