The /timeout command only works in the Twitch chat (web browser). AFAIK, you have to use "msg $chan .timeout $nick 120", which will do the same as using /timeout in the web chat (except it's visible).
I made that change to your script, and it's working as intended.