For those of us who don't use twitch, it can be hard to give advice because of how twitch violates the rules of the IRC protocol, which means things can work there that don't work elsewhere, and vice-versa.
For example, you say it's working in mIRC, but according to the "real" irc rules, it should not be. The ON TEXT event is for received text, not for text you create, so the only time where it would trigger against your own text is when you open a query window against yourself and see the incoming text from yourself. Well, maybe if the server is sending your own messages back to yourself.
At "real" irc networks, instead of the ON TEXT, we'd use ON INPUT which triggers each time you input. And the 1st line would change

from:
on *:text:*:#: {
to:
ON *:INPUT:*:{ if (/* iswm $1) return | if (!$chan) return

This is checking for input that's a /command that doesn't get messaged to channel, and also skips input that's not in a channel window

Whenever I went on twitch, i could never find any channels with anyone in it, that looks like this. The /list command to find channels didn't work