/** * Sets the <b><u>nsfw flag</u></b> of the selected {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}. * * @param nsfw * The new nsfw flag for the selected {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}, * * @throws net.dv8tion.jda.core.exceptions.InsufficientPermissionException * If the currently logged in account does not have the Permission {@link net.dv8tion.jda.core.Permission#MANAGE_CHANNEL MANAGE_CHANNEL} * @throws IllegalStateException * If the selected {@link net.dv8tion.jda.core.entities.Channel Channel}'s type is not {@link net.dv8tion.jda.core.entities.ChannelType#TEXT TEXT} * * @return ChannelManager for chaining convenience */ @CheckReturnValue public ChannelManager setNSFW(boolean nsfw) { if (getType() != ChannelType.TEXT) throw new IllegalStateException("Can only set nsfw on text channels"); this.nsfw = nsfw; set |= NSFW; return this; }
/** * Sets the <b><u>topic</u></b> of the selected {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}. * * <p>A channel topic <b>must not</b> be more than {@code 1024} characters long! * <br><b>This is only available to {@link net.dv8tion.jda.core.entities.TextChannel TextChannels}</b> * * @param topic * The new topic for the selected {@link net.dv8tion.jda.core.entities.TextChannel TextChannel}, * {@code null} or empty String to reset * * @throws UnsupportedOperationException * If the selected {@link net.dv8tion.jda.core.entities.Channel Channel}'s type is not {@link net.dv8tion.jda.core.entities.ChannelType#TEXT TEXT} * @throws IllegalArgumentException * If the provided topic is greater than {@code 1024} in length * * @return ChannelManager for chaining convenience */ @CheckReturnValue public ChannelManager setTopic(String topic) { if (getType() != ChannelType.TEXT) throw new IllegalStateException("Can only set topic on text channels"); Checks.check(topic == null || topic.length() <= 1024, "Topic must be less or equal to 1024 characters in length"); this.topic = topic; set |= TOPIC; return this; }
public ChannelManager setSlowmode(int slowmode) if (getType() != ChannelType.TEXT) throw new IllegalStateException("Can only set slowmode on text channels"); Checks.check(slowmode <= 120 && slowmode >= 0, "Slowmode per user must be between 0 and 120 (seconds)!");
/** * Sets the <b><u>user-limit</u></b> of the selected {@link net.dv8tion.jda.core.entities.VoiceChannel VoiceChannel}. * <br>Provide {@code 0} to reset the user-limit of the {@link net.dv8tion.jda.core.entities.VoiceChannel VoiceChannel} * * <p>A channel user-limit <b>must not</b> be negative nor greater than {@code 99}! * <br><b>This is only available to {@link net.dv8tion.jda.core.entities.VoiceChannel VoiceChannels}</b> * * @param userLimit * The new user-limit for the selected {@link net.dv8tion.jda.core.entities.VoiceChannel VoiceChannel} * * @throws IllegalStateException * If the selected {@link net.dv8tion.jda.core.entities.Channel Channel}'s type is not {@link net.dv8tion.jda.core.entities.ChannelType#VOICE VOICE} * @throws IllegalArgumentException * If the provided user-limit is negative or greater than {@code 99} * * @return ChannelManager for chaining convenience */ @CheckReturnValue public ChannelManager setUserLimit(int userLimit) { if (getType() != ChannelType.VOICE) throw new IllegalStateException("Can only set userlimit on voice channels"); Checks.notNegative(userLimit, "Userlimit"); Checks.check(userLimit <= 99, "Userlimit may not be greater than 99"); this.userlimit = userLimit; set |= USERLIMIT; return this; }
/** * Sets the <b><u>name</u></b> of the selected {@link net.dv8tion.jda.core.entities.Channel Channel}. * * <p>A channel name <b>must not</b> be {@code null} nor empty or more than 100 characters long! * <br>TextChannel names may only be populated with alphanumeric (with underscore and dash). * * <p><b>Example</b>: {@code mod-only} or {@code generic_name} * <br>Characters will automatically be lowercased by Discord for text channels! * * @param name * The new name for the selected {@link net.dv8tion.jda.core.entities.Channel Channel} * * @throws IllegalArgumentException * If the provided name is {@code null} or not between 1-100 characters long * * @return ChannelManager for chaining convenience */ @CheckReturnValue public ChannelManager setName(String name) { Checks.notBlank(name, "Name"); Checks.check(name.length() > 0 && name.length() <= 100, "Name must be between 1-100 characters long"); if (getType() == ChannelType.TEXT) Checks.noWhitespace(name, "Name"); this.name = name; set |= NAME; return this; }
/** * Sets the <b><u>{@link net.dv8tion.jda.core.entities.Category Parent Category}</u></b> * of the selected {@link net.dv8tion.jda.core.entities.Channel Channel}. * * * @param category * The new parent for the selected {@link net.dv8tion.jda.core.entities.Channel Channel} * * @throws IllegalStateException * If the target is a category itself * @throws IllegalArgumentException * If the provided category is not from the same Guild * * @return ChannelManager for chaining convenience * * @since 3.4.0 */ @CheckReturnValue public ChannelManager setParent(Category category) { if (category != null) { if (getType() == ChannelType.CATEGORY) throw new IllegalStateException("Cannot set the parent of a category"); Checks.check(category.getGuild().equals(getGuild()), "Category is not from the same guild"); } this.parent = category == null ? null : category.getId(); set |= PARENT; return this; }
public ChannelManager setBitrate(int bitrate) if (getType() != ChannelType.VOICE) throw new IllegalStateException("Can only set bitrate on voice channels"); final int maxBitrate = getGuild().getFeatures().contains("VIP_REGIONS") ? 128000 : 96000;