alias query {
query $$1-
; your code
}
Or if you like to have the manual opening of a query triggered by an event, use a signal.
alias query {
query $$1-
.signal QOPEN $1-
}
[color:red] [/color]
on *:SIGNAL:QOPEN:{
; your code
}
/help signal to check out the options you have.
By scripting a custom query alias, it overrides the behaviour of the default one. If you want to trigger the default one, prefix the command with an exclamation mark !, like /!query or !query in scripts.
I've put "; your code" in the examples, but where you put it is up to you, you can put it in front of the actual query command so that things are done or checked prior to the opening of the query. Same goes for the signal, since it's the same principle.