Package net.dv8tion.jda.core.managers
Class WebhookManager
- java.lang.Object
-
- net.dv8tion.jda.core.requests.RestAction<T>
-
- net.dv8tion.jda.core.requests.restaction.AuditableRestAction<java.lang.Void>
-
- net.dv8tion.jda.core.managers.impl.ManagerBase
-
- net.dv8tion.jda.core.managers.WebhookManager
-
public class WebhookManager extends net.dv8tion.jda.core.managers.impl.ManagerBase
Manager providing functionality to update one or more fields for aWebhook
.Example
manager.setName("GitHub Webhook") .setChannel(channel) .queue(); manager.reset(WebhookManager.NAME | WebhookManager.AVATAR) .setName("Meme Feed") .setAvatar(null) .queue();
- See Also:
Webhook.getManager()
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.dv8tion.jda.core.requests.restaction.AuditableRestAction
AuditableRestAction.EmptyRestAction<T>
-
-
Field Summary
Fields Modifier and Type Field Description static long
AVATAR
Used to reset the avatar fieldstatic long
CHANNEL
Used to reset the channel fieldstatic long
NAME
Used to reset the name field-
Fields inherited from class net.dv8tion.jda.core.requests.RestAction
DEFAULT_FAILURE, DEFAULT_SUCCESS, LOG
-
-
Constructor Summary
Constructors Constructor Description WebhookManager(Webhook webhook)
Creates a new WebhookManager instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TextChannel
getChannel()
TheTextChannel
this Manager'sWebhook
is in.Guild
getGuild()
Webhook
getWebhook()
The targetWebhook
that will be modified by this managerWebhookManager
reset()
Resets all fields for this manager.WebhookManager
reset(long fields)
Resets the fields specified by the provided bit-flag pattern.WebhookManager
reset(long... fields)
Resets the fields specified by the provided bit-flag patterns.WebhookManager
setAvatar(Icon icon)
Sets the default avatar of the selectedWebhook
.WebhookManager
setChannel(TextChannel channel)
Sets theTextChannel
of the selectedWebhook
.WebhookManager
setName(java.lang.String name)
Sets the default name of the selectedWebhook
.-
Methods inherited from class net.dv8tion.jda.core.managers.impl.ManagerBase
complete, isPermissionChecksEnabled, queue, setPermissionChecksEnabled
-
Methods inherited from class net.dv8tion.jda.core.requests.restaction.AuditableRestAction
reason, setCheck
-
Methods inherited from class net.dv8tion.jda.core.requests.RestAction
complete, completeAfter, getJDA, isPassContext, queue, queue, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, queueAfter, setPassContext, submit, submit, submitAfter, submitAfter
-
-
-
-
Field Detail
-
NAME
public static final long NAME
Used to reset the name field- See Also:
- Constant Field Values
-
CHANNEL
public static final long CHANNEL
Used to reset the channel field- See Also:
- Constant Field Values
-
AVATAR
public static final long AVATAR
Used to reset the avatar field- See Also:
- Constant Field Values
-
-
Method Detail
-
getGuild
public Guild getGuild()
TheGuild
this Manager'sWebhook
is in.
This is logically the same as callinggetWebhook().getGuild()
- Returns:
- The parent
Guild
-
getChannel
public TextChannel getChannel()
TheTextChannel
this Manager'sWebhook
is in.
This is logically the same as callinggetWebhook().getChannel()
- Returns:
- The parent
TextChannel
-
getWebhook
public Webhook getWebhook()
The targetWebhook
that will be modified by this manager- Returns:
- The target
Webhook
-
reset
@CheckReturnValue public WebhookManager reset(long fields)
Resets the fields specified by the provided bit-flag pattern. You can specify a combination by using a bitwise OR concat of the flag constants.
Example:manager.reset(WebhookManager.CHANNEL | WebhookManager.NAME);
Flag Constants:
- Overrides:
reset
in classnet.dv8tion.jda.core.managers.impl.ManagerBase
- Parameters:
fields
- Integer value containing the flags to reset.- Returns:
- WebhookManager for chaining convenience
-
reset
@CheckReturnValue public WebhookManager reset(long... fields)
Resets the fields specified by the provided bit-flag patterns. You can specify a combination by using a bitwise OR concat of the flag constants.
Example:manager.reset(WebhookManager.CHANNEL, WebhookManager.NAME);
Flag Constants:
- Overrides:
reset
in classnet.dv8tion.jda.core.managers.impl.ManagerBase
- Parameters:
fields
- Integer values containing the flags to reset.- Returns:
- WebhookManager for chaining convenience
-
reset
@CheckReturnValue public WebhookManager reset()
Resets all fields for this manager.- Returns:
- WebhookManager for chaining convenience
-
setName
@CheckReturnValue public WebhookManager setName(java.lang.String name)
Sets the default name of the selectedWebhook
.A webhook name must not be
null
or blank!- Parameters:
name
- The new default name for the selectedWebhook
- Returns:
- WebhookManager for chaining convenience
- Throws:
java.lang.IllegalArgumentException
- If the provided name isnull
or blank
-
setAvatar
@CheckReturnValue public WebhookManager setAvatar(Icon icon)
Sets the default avatar of the selectedWebhook
.
-
setChannel
@CheckReturnValue public WebhookManager setChannel(TextChannel channel)
Sets theTextChannel
of the selectedWebhook
.A webhook channel must not be
null
and must be in the sameGuild
!- Parameters:
channel
- The newTextChannel
for the selectedWebhook
- Returns:
- WebhookManager for chaining convenience
- Throws:
InsufficientPermissionException
- If the currently logged in account does not have the PermissionMANAGE_WEBHOOKS
in the specified TextChanneljava.lang.IllegalArgumentException
- If the provided channel isnull
or from a different Guild
-
-