@Override public Guild getGuild() { return getChannel().getGuild(); }
/** * The {@link net.dv8tion.jda.core.entities.Guild Guild} this Manager's * {@link net.dv8tion.jda.core.entities.Channel Channel} is in. * <br>This is logically the same as calling {@code getChannel().getGuild()} * * @return The parent {@link net.dv8tion.jda.core.entities.Guild Guild} */ public Guild getGuild() { return getChannel().getGuild(); }
@Override protected void validateInput(T entity) { Checks.check(entity.getGuild().equals(guild), "Provided channel is not from this Guild!"); Checks.check(orderList.contains(entity), "Provided channel is not in the list of orderable channels!"); }
default ChannelAction createCopy() return createCopy(getGuild());
@Override public List<Permission> getPermissions(Channel channel) { if (!getGuild().equals(channel.getGuild())) throw new IllegalArgumentException("Provided channel is not in the same guild as this member!"); return Collections.unmodifiableList( Permission.getPermissions( PermissionUtil.getEffectivePermission(channel, this))); }
private void checkPermission(Permission permission) { if (channel.getType() == ChannelType.TEXT) { Channel location = (Channel) channel; if (!location.getGuild().getSelfMember().hasPermission(location, permission)) throw new InsufficientPermissionException(permission); } }
checkGuild(channel.getGuild(), guild, "Member");
Checks.check(channels.stream().allMatch(c -> guild.equals(c.getGuild())), "One or more channels are not from the correct guild"); Checks.check(channels.stream().allMatch(c -> c.getType().equals(type)),
Member member = chan.getGuild().getMemberById(id); if (member == null) throw new NoSuchElementException("Attempted to create a PermissionOverride for a non-existent user. Guild: " + chan.getGuild() + ", Channel: " + chan + ", JSON: " + override); Role role = ((GuildImpl) chan.getGuild()).getRolesMap().get(id); if (role == null) throw new NoSuchElementException("Attempted to create a PermissionOverride for a non-existent role! JSON: " + override);
Checks.notNull(member, "Member"); Checks.check(channel.getGuild().equals(member.getGuild()), "Provided channel and provided member are not of the same guild!");
Checks.notNull(role, "Role"); Guild guild = channel.getGuild(); if (!guild.equals(role.getGuild())) throw new IllegalArgumentException("Provided channel and role are not of the same guild!");
if (!channel.getGuild().getSelfMember().hasPermission(channel, Permission.MESSAGE_MANAGE)) throw new InsufficientPermissionException(Permission.MESSAGE_MANAGE);
Checks.notNull(permissions, "Permissions"); GuildImpl guild = (GuildImpl) channel.getGuild(); checkGuild(guild, member.getGuild(), "Member");
Checks.check(getGuild().equals(syncSource.getGuild()), "Sync only works for channels of same guild");
checkGuild(channel.getGuild(), guild, "Role");