I don't understand your question, because it looks like you're already doing a different behavior depending on whether the channel is named #debug or not.

Are you saying you want the code to be modified to call the not-being-used motor2 when the channel name is #debug, instead of doing the current echo?

Note that you don't need to use the global variable %menchan if you will always be using it from within the ON TEXT event where the alias can also see the $chan string.

Also, you should get into the habit of putting parenthesis around the terms of your if() condition, because when you do not do that, it gives you the $v1 and $v2 from the wrong evaluation, which is almost certainly what you do not want. Plus, it's easier to read the code when you do have the parenthesis. See the difference in the output when I do/don't use the parenthesis:

//if foo == bar noop | if string1 != string2 echo -a v1 $v1 and v2 $v2
result: v1 foo and v2 bar
//if foo == bar noop | if (string1 != string2) echo -a v1 $v1 and v2 $v2
result: v1 string1 and v2 string2