Using $comchan($nick,1) will return the name of the first channel you are currently in with that nick.