I know $nick means the nick of the person typing.

As for the rest of what you said, it makes no sense to me.

Could you provide a snippet?