public RoleManager setPermissions(long perms) long selfPermissions = PermissionUtil.getEffectivePermission(getGuild().getSelfMember()); setupPermissions(); long missingPerms = perms; // include permissions we want to set to
@Override protected boolean checkPermissions() { Member selfMember = getGuild().getSelfMember(); if (!selfMember.hasPermission(Permission.MANAGE_ROLES)) throw new InsufficientPermissionException(Permission.MANAGE_ROLES); if (!selfMember.canInteract(getRole())) throw new HierarchyException("Cannot modify a role that is higher or equal in hierarchy"); return super.checkPermissions(); /* //we can't reliably check the permissions of the role here long missingRaw = permissions; missingRaw &= ~selfPermissions; // exclude own perms missingRaw &= ~role.getPermissionsRaw(); // exclude role perms if (missingRaw != 0) { List<Permission> missingPermissions = Permission.getPermissions(missingRaw); if (!missingPermissions.isEmpty()) throw new InsufficientPermissionException(missingPermissions.get(0)); } */ }