Well, Arcana beat me to it, but I was going to describe the process in a slightly different way.
Step 1: Subtract the bot's coordinates from the target's coordinates. That effectively gives you the target's position in what we'll call "bot-space" -- a coordinate system in which the bot is the center of the universe.
Step 2: Normalize the resulting vector. That means calculate the magnitude of it (sqrt(x^2 + y^2 + z^2)), and divide each coordinate by that magnitude. What that gives you is a unit vector pointing at the target. This is also known as the desired
forward vector, since it's the direction you want to face.
Step 3: Use any of the well-known formulas to convert a unit vector to YPR. Assuming my trig is right (please feel free to verify and correct if necessary), you can get yaw and pitch from your vector like this:
P = asin(y)
Y = atan2(x/cos(P), z/cos(P))
R = 0
You'll need special handling for y=+/- 1 to avoid a division by zero. In that case just set P=+/- pi/2 (90 degrees) and Y=atan2(-z,x).
To deal with roll you would need a full rotation matrix, or at least both a forward and an up vector, but you probably don't have any reason to need it so you can simply leave it zero. I got the idea of dividing by cos(P) from
this publication, which goes into a much more detailed discussion of methods for extracting Euler angles from a rotation matrix (of which the 'forward' vector we're discussing is the third row that defines the Z axis). Though be aware that it describes PYR order and needs some adjustment for YPR.
At some point in the future I'll probably add protocol support for optional alternative methods of specifying orientation that may be more convenient than Euler angles. Likely quaternions. In that case it's relatively simple to convert the forward unit vector into a quaternion; just a cross product to get a parallel vector and a dot product for the magnitude of the rotation.