public class WebhookManagerUpdatable
extends java.lang.Object
updatable manager that allows
to modify webhook settings like the default name or the default avatar.
This manager allows to modify multiple fields at once
by getting the WebhookField for specific
properties and setting or resetting their values; followed by a call of update()!
The WebhookManager implementation
simplifies this process by giving simple setters that return the update RestAction
Note: To update this manager
the currently logged in account requires the Permission MANAGE_WEBHOOKS in the parent TextChannel
| Constructor and Description |
|---|
WebhookManagerUpdatable(Webhook webhook)
Creates a new WebhookManagerUpdatable instance
|
| Modifier and Type | Method and Description |
|---|---|
WebhookField<Icon> |
getAvatarField()
|
TextChannel |
getChannel()
The
TextChannel this Manager's
Webhook is in. |
WebhookField<TextChannel> |
getChannelField()
|
Guild |
getGuild()
|
JDA |
getJDA()
The
JDA instance of this Manager |
WebhookField<java.lang.String> |
getNameField()
|
Webhook |
getWebhook()
The target
Webhook
that will be modified by this manager |
void |
reset()
Resets all
Fields
for this manager instance by calling Field.reset() sequentially
This is automatically called by update() |
AuditableRestAction<java.lang.Void> |
update()
Creates a new
RestAction instance
that will apply all changes that have been made to this manager instance. |
public Guild getGuild()
Guild this Manager's
Webhook is in.
getWebhook().getGuild()Guildpublic TextChannel getChannel()
TextChannel this Manager's
Webhook is in.
getWebhook().getChannel()TextChannelpublic Webhook getWebhook()
Webhook
that will be modified by this managerWebhookpublic WebhookField<java.lang.String> getNameField()
WebhookField
for the name of the selected Webhook's default User.
To set the value use setValue(String)
on the returned WebhookField instance.
A Webhook name must bot be null!
Otherwise Field.setValue(...) will
throw an IllegalArgumentException.
WebhookField - Type: Stringpublic WebhookField<Icon> getAvatarField()
WebhookField
for the avatar of the selected Webhook's default User.
null
To set the value use setValue(Icon)
on the returned WebhookField instance.
WebhookField - Type: Iconpublic WebhookField<TextChannel> getChannelField()
WebhookField
for the TextChannel
of the selected Webhook's default User.
To set the value use setValue(TextChannel)
on the returned WebhookField instance.
A Webhook channel must bot be null and must be from the same Guild!
Otherwise Field.setValue(...) will
throw an IllegalArgumentException.
WebhookField - Type: TextChannelpublic void reset()
Fields
for this manager instance by calling Field.reset() sequentially
update()@CheckReturnValue public AuditableRestAction<java.lang.Void> update()
RestAction instance
that will apply all changes that have been made to this manager instance.
EmptyRestAction.
Before applying new changes it is recommended to call reset() to reset previous changes.
This is automatically called if this method returns successfully.
Possible ErrorResponses for this
update include the following:
UNKNOWN_CHANNEL
MISSING_ACCESS
MISSING_PERMISSIONS
MANAGE_WEBHOOKS PermissionAuditableRestAction
InsufficientPermissionException - If the currently logged in account does not have the Permission MANAGE_WEBHOOKS
in either the current or selected new TextChannel.