on !*:join:#mychannel:{
if guest* iswm $nick { msg $chan $nick ... }
else { msg $chan $nick .... }

You should only do this for channels that say you can. All other channels MIGHT ban you for this kind of stuff. Some things to note:

1) the ! switch replace if ($nick != $me)
2) #mychan is your channel (not somebody else's) unless you get approval from the ops in another channel to use that

Those who fail history are doomed to repeat it