/** * 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; }
final int maxBitrate = getGuild().getFeatures().contains("VIP_REGIONS") ? 128000 : 96000; Checks.check(bitrate >= 8000, "Bitrate must be greater or equal to 8000"); Checks.check(bitrate <= maxBitrate, "Bitrate must be less or equal to %s", maxBitrate);
@Override protected boolean checkPermissions() { final Member selfMember = getGuild().getSelfMember(); if (!selfMember.hasPermission(getChannel(), Permission.MANAGE_CHANNEL)) throw new InsufficientPermissionException(Permission.MANAGE_CHANNEL); return super.checkPermissions(); }
Checks.check(permHolder.getGuild().equals(getGuild()), "PermissionHolder is not from the same Guild!"); if (isPermissionChecksEnabled() && !getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS)) throw new InsufficientPermissionException(Permission.MANAGE_PERMISSIONS); final long id = getId(permHolder);
Checks.check(permHolder.getGuild().equals(getGuild()), "PermissionHolder is not from the same Guild!"); if (isPermissionChecksEnabled() && !getGuild().getSelfMember().hasPermission(getChannel(), Permission.MANAGE_PERMISSIONS)) throw new InsufficientPermissionException(Permission.MANAGE_PERMISSIONS); final long id = getId(permHolder);