All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.dv8tion.jda.api.entities.channel.attribute.IWebhookContainer Maven / Gradle / Ivy

Go to download

Java wrapper for the popular chat & VOIP service: Discord https://discord.com

There is a newer version: 5.1.0
Show newest version
/*
 * Copyright 2015 Austin Keener, Michael Ritter, Florian Spieß, and the JDA contributors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.dv8tion.jda.api.entities.channel.attribute;

import net.dv8tion.jda.api.entities.Webhook;
import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel;
import net.dv8tion.jda.api.requests.RestAction;
import net.dv8tion.jda.api.requests.restaction.AuditableRestAction;
import net.dv8tion.jda.api.requests.restaction.WebhookAction;
import org.jetbrains.annotations.Unmodifiable;

import javax.annotation.CheckReturnValue;
import javax.annotation.Nonnull;
import java.util.List;

/**
 * Represents a {@link 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. */ public interface IWebhookContainer extends GuildChannel { /** * Retrieves the {@link net.dv8tion.jda.api.entities.Webhook Webhooks} attached to this channel. * *

Possible ErrorResponses include: *

    *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} *
    if this channel was deleted
  • * *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} *
    if we were removed from the guild
  • *
* * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have * {@link net.dv8tion.jda.api.Permission#MANAGE_WEBHOOKS Permission.MANAGE_WEBHOOKS} in this channel. * * @return {@link net.dv8tion.jda.api.requests.RestAction} - Type: List{@literal <}{@link net.dv8tion.jda.api.entities.Webhook Webhook}{@literal >} *
Retrieved an immutable list of Webhooks attached to this channel */ @Nonnull @CheckReturnValue RestAction<@Unmodifiable List> retrieveWebhooks(); /** * Creates a new {@link net.dv8tion.jda.api.entities.Webhook Webhook}. * *

Possible {@link net.dv8tion.jda.api.requests.ErrorResponse ErrorResponses} caused by * the returned {@link net.dv8tion.jda.api.requests.RestAction RestAction} include the following: *

    *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} *
    The webhook could not be created due to a permission discrepancy
  • * *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} *
    The {@link net.dv8tion.jda.api.Permission#VIEW_CHANNEL VIEW_CHANNEL} permission was removed
  • * *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MAX_WEBHOOKS MAX_WEBHOOKS} *
    If the channel already has reached the maximum capacity for webhooks
  • *
* * @param name * The default name for the new Webhook. * * @throws net.dv8tion.jda.api.exceptions.PermissionException * If you do not hold the permission {@link net.dv8tion.jda.api.Permission#MANAGE_WEBHOOKS Manage Webhooks} * @throws IllegalArgumentException * If the provided name is {@code null}, blank or not * between 2-100 characters in length * * @return A specific {@link WebhookAction WebhookAction} *
This action allows to set fields for the new webhook before creating it */ @Nonnull @CheckReturnValue WebhookAction createWebhook(@Nonnull String name); /** * Deletes a {@link net.dv8tion.jda.api.entities.Webhook Webhook} attached to this channel * by the {@code id} specified. * *

Possible ErrorResponses include: *

    *
  • {@link net.dv8tion.jda.api.requests.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.
  • * *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#UNKNOWN_CHANNEL UNKNOWN_CHANNEL} *
    if this channel was deleted
  • * *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_ACCESS MISSING_ACCESS} *
    if we were removed from the guild
  • * *
  • {@link net.dv8tion.jda.api.requests.ErrorResponse#MISSING_PERMISSIONS MISSING_PERMISSIONS} *
    The send request was attempted after the account lost * {@link net.dv8tion.jda.api.Permission#MANAGE_WEBHOOKS Permission.MANAGE_WEBHOOKS} in the channel.
  • *
* * @param id * The not-null id for the target Webhook. * * @throws java.lang.IllegalArgumentException * If the provided {@code id} is {@code null} or empty. * @throws net.dv8tion.jda.api.exceptions.InsufficientPermissionException * If the currently logged in account does not have * {@link net.dv8tion.jda.api.Permission#MANAGE_WEBHOOKS Permission.MANAGE_WEBHOOKS} in this channel. * * @return {@link net.dv8tion.jda.api.requests.restaction.AuditableRestAction AuditableRestAction} */ @Nonnull @CheckReturnValue AuditableRestAction deleteWebhookById(@Nonnull String id); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy