Would be better to store the channel name in a variable, accessible only by its local counter-parts.
alias -l ch { return #VN }
Stress test, and debug your code before submitting. One thing I've noticed is small "fatal" errors that won't allow the code to run on another snippet you recently submitted.
Another thing is, I noticed your if statements are empty., yet the else statements have code to execute. Why not flip-flop those, and simply have
if ($chan != #VN) {
This would cut out the middle man, and have a more efficient code setup.