The $dns(N) identifier
This identifier can be used only in the on DNS event, and returns the address that was resolved and any associated IP addresses.

Properties: nick, addr, ip


$dns.addr is what you are looking for (not sure if it is necessary to specify the n parameter)

/help on dns
for more info