Interface IWebhookContainer
- All Superinterfaces:
Channel
,Comparable<GuildChannel>
,Formattable
,GuildChannel
,IMentionable
,ISnowflake
- All Known Subinterfaces:
ForumChannel
,IWebhookContainerUnion
,NewsChannel
,StageChannel
,StandardGuildMessageChannel
,TextChannel
,VoiceChannel
Represents a
GuildChannel
that is capable of utilizing webhooks.
Webhooks can be used to integrate third-party systems into Discord by way of sending information via messages.-
Field Summary
Fields inherited from interface net.dv8tion.jda.api.entities.channel.Channel
MAX_NAME_LENGTH
Fields inherited from interface net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
JUMP_URL
-
Method Summary
Modifier and TypeMethodDescriptioncreateWebhook
(String name) Creates a newWebhook
.Deletes aWebhook
attached to this channel by theid
specified.Retrieves theWebhooks
attached to this channel.Methods inherited from interface net.dv8tion.jda.api.entities.channel.Channel
formatTo, getAsMention, getFlags, getJDA, getName, getType
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface net.dv8tion.jda.api.entities.channel.middleman.GuildChannel
delete, getGuild, getJumpUrl, getManager, getPermissionContainer
Methods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Method Details
-
retrieveWebhooks
Retrieves theWebhooks
attached to this channel.Possible ErrorResponses include:
UNKNOWN_CHANNEL
if this channel was deletedMISSING_ACCESS
if we were removed from the guild
- Returns:
RestAction
- Type: List<Webhook
>
Retrieved an immutable list of Webhooks attached to this channel
-
createWebhook
Creates a newWebhook
.Possible
ErrorResponses
caused by the returnedRestAction
include the following:MISSING_PERMISSIONS
The webhook could not be created due to a permission discrepancyMISSING_ACCESS
TheVIEW_CHANNEL
permission was removedMAX_WEBHOOKS
If the channel already has reached the maximum capacity for webhooks
- Parameters:
name
- The default name for the new Webhook.- Returns:
- A specific
WebhookAction
This action allows to set fields for the new webhook before creating it - Throws:
PermissionException
- If you do not hold the permissionManage Webhooks
IllegalArgumentException
- If the provided name isnull
, blank or not between 2-100 characters in length
-
deleteWebhookById
Deletes aWebhook
attached to this channel by theid
specified.Possible ErrorResponses include:
ErrorResponse.UNKNOWN_WEBHOOK
The provided id does not refer to a WebHook present in this channel, either due to it not existing or having already been deleted.UNKNOWN_CHANNEL
if this channel was deletedMISSING_ACCESS
if we were removed from the guildMISSING_PERMISSIONS
The send request was attempted after the account lostPermission.MANAGE_WEBHOOKS
in the channel.
- Parameters:
id
- The not-null id for the target Webhook.- Returns:
AuditableRestAction
- Throws:
IllegalArgumentException
- If the providedid
isnull
or empty.InsufficientPermissionException
- If the currently logged in account does not havePermission.MANAGE_WEBHOOKS
in this channel.
-