Yes, that might work, what he actually wants to know, is if they are on a certain channel.
While ison #channel will work, it will (as pointed out) work only if you are on that channel as well.
You would need to use a whois and capture the channel raw to figure out the channels the client is on, before sending the message away (based on what the question is).
This is rather messy, and can create lag, and if you do it frequently, you could be killed for flooding.