why raw event embedded in ON *:TEXT: don't go ?

I have this code :

ON *:TEXT:*:?:{

if ( server1 isin $server ) { echo -a $nick usa simosnap }
if ( server2 isin $server ) { whois $nick }

raw 311:*:{ echo -a $1- }


If I'm using server2 , I must check the $nick server ( I check the $nick irc server using whois $nick and parsing the output with raw 311:*:{....} ),
if he's using a particular server I must do a action, else another.

The problem is that it is not possible include raw inside a if-then ( and not even in another event ) , this give me a understood output, something like this ( for the code above ) :

mario-- has been idle 0secs, signed on Tue Nov 27 09:32:58
mario-- End of /WHOIS list.
311:*:{ Unknown command

How may I solve this problem ?

Last edited by Anti; 27/11/18 03:23 AM.