Package net.dv8tion.jda.api.entities
Interface IWebhookContainer
- All Superinterfaces:
Channel,Comparable<GuildChannel>,Formattable,GuildChannel,IMentionable,ISnowflake
- All Known Subinterfaces:
IWebhookContainerUnion,NewsChannel,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.GuildChannel
JUMP_URL -
Method Summary
Modifier and TypeMethodDescriptioncreateWebhook(String name) Creates a newWebhook.Deletes aWebhookattached to this channel by theidspecified.Retrieves theWebhooksattached to this channel.Methods inherited from interface net.dv8tion.jda.api.entities.Channel
formatTo, getAsMention, getJDA, getName, getTypeMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface net.dv8tion.jda.api.entities.GuildChannel
delete, getGuild, getJumpUrl, getManager, getPermissionContainerMethods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getIdLong, getTimeCreated
-
Method Details
-
retrieveWebhooks
Retrieves theWebhooksattached 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
ErrorResponsescaused by the returnedRestActioninclude the following:MISSING_PERMISSIONS
The webhook could not be created due to a permission discrepancyMISSING_ACCESS
TheVIEW_CHANNELpermission 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 WebhooksIllegalArgumentException- If the provided name isnull, blank or not between 2-100 characters in length
-
deleteWebhookById
Deletes aWebhookattached to this channel by theidspecified.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_WEBHOOKSin the channel.
- Parameters:
id- The not-null id for the target Webhook.- Returns:
AuditableRestAction- Throws:
IllegalArgumentException- If the providedidisnullor empty.InsufficientPermissionException- If the currently logged in account does not havePermission.MANAGE_WEBHOOKSin this channel.
-