You need to add a space on
Code
){/msg $chan hi }


So use:

Code
) { /msg $chan hi }


Check and use the format as you see in the examples exactly, you can see more examples in the online wiki https://en.wikichip.org/wiki/mirc