sorry man. i had no intention to be rude but the solution is just not good.
i wrote the code you said, then i performed a whois on a random person in the channel and a query opened to them. and this isn't what i wanted. i don't need query windows opened randomly
it's logical since you wrote "query $$1"....
agains sorry if i seemed rude.