$replace($1-.|,-,%,-,$,-)
What's with the .| at the end, why do you add that to $1-?
In any case, replacing $ and % by - is just incorrect, if you want to properly escape those, you must use the
safe alias. It's best to use $safe() around $chan too, which might become a problem in the future (though for now, a static channel name is used, no injection is possible)