$target returns the parameter after the command part in a rawmsg for most events:

<- :user!ident@host QUIT :Quit: