We'll need to see the rest of the script. Currently, the reason that it notices the user but doesn't send the result to the channel is because %pchan isn't defined. A ctcp reply is not channel specific so the script doesn't know what channel to send the message to.

Also, you already mentioned that this is only supposed to work for a single channel. Then you can try just setting %pchan to that channel. E.g.:

/set %pchan #whatever-channel-name


"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke